g*k
5 楼
试了。但是用sendmessage没反应。我试了试右下角的时间句柄,显示的句柄数字是对
的,用sendmessage双击,时间的窗口也是没反应。如果我用sendkeys的话,可以显示
跳出的时间窗口,但是我要的那个程序keyboard不是focusable的,所以不能用这个方
法。下面是用sendmessage写的程序,能帮忙看看哪里出的问题吗?谢谢了!
...
Private Declare Function ShowWindow Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal nCmdShow As SHOW_WINDOW _
) As Boolean
Private Declare Auto Function FindWindow Lib "user32" _
(ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
Private Declare Auto Function FindWindowEx Lib "user32" _
(ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, _
ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
Private Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd
As IntPtr, ByVal msg As UInteger, ByVal wParam As Integer, ByVal lParam As
IntPtr) As IntPtr
Private Sub FindHandle_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles FindHandle.Click
Const BM_CLICK As UInteger = &HF5&
Dim hTaskbar As IntPtr = FindWindow("Shell_TrayWnd", vbNullString)
Dim hBar As IntPtr = FindWindowEx(hTaskbar, 0, "TrayNotifyWnd",
vbNullString)
Dim hTime As IntPtr = FindWindowEx(hBar, 0, "TrayClockWClass",
vbNullString)
If hTime <> IntPtr.Zero Then
SendMessage(hTime, BM_CLICK, 0, IntPtr.Zero)
'Thread.Sleep(50)
SendMessage(hTime, BM_CLICK, 0, IntPtr.Zero)
End If
End Sub
...
【在 a9 的大作中提到】
: 找到这个小图标的句柄,发一下双击事件?
的,用sendmessage双击,时间的窗口也是没反应。如果我用sendkeys的话,可以显示
跳出的时间窗口,但是我要的那个程序keyboard不是focusable的,所以不能用这个方
法。下面是用sendmessage写的程序,能帮忙看看哪里出的问题吗?谢谢了!
...
Private Declare Function ShowWindow Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal nCmdShow As SHOW_WINDOW _
) As Boolean
Private Declare Auto Function FindWindow Lib "user32" _
(ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
Private Declare Auto Function FindWindowEx Lib "user32" _
(ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, _
ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
Private Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd
As IntPtr, ByVal msg As UInteger, ByVal wParam As Integer, ByVal lParam As
IntPtr) As IntPtr
Private Sub FindHandle_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles FindHandle.Click
Const BM_CLICK As UInteger = &HF5&
Dim hTaskbar As IntPtr = FindWindow("Shell_TrayWnd", vbNullString)
Dim hBar As IntPtr = FindWindowEx(hTaskbar, 0, "TrayNotifyWnd",
vbNullString)
Dim hTime As IntPtr = FindWindowEx(hBar, 0, "TrayClockWClass",
vbNullString)
If hTime <> IntPtr.Zero Then
SendMessage(hTime, BM_CLICK, 0, IntPtr.Zero)
'Thread.Sleep(50)
SendMessage(hTime, BM_CLICK, 0, IntPtr.Zero)
End If
End Sub
...
【在 a9 的大作中提到】
: 找到这个小图标的句柄,发一下双击事件?
g*k
6 楼
已解决
v*n
7 楼
要不试试UIAutomation
这个帖子最下面有个例子
http://social.msdn.microsoft.com/forums/en-US/windowsaccessibil
【在 g**k 的大作中提到】
: 已解决
这个帖子最下面有个例子
http://social.msdn.microsoft.com/forums/en-US/windowsaccessibil
【在 g**k 的大作中提到】
: 已解决
相关阅读
question: Any benefits for C#程序中写CLR存储过程Writing CLR Stored Procedures in C# ?SQL Navigator for oracle可以连team foundation server 2010吗 (转载)asp.net咋不用javascript做client-side编程?10 Free Microsoft eBooks on Microsoft SQL, Windows Phone Pr (转载)【CINASSUG】【CINAOUG】SQL Server 讲座第3课- BI技术交流 ag (转载)ajax,json,jquery怎么自学?asp.net有啥特殊好使的方法保护email?Any list of MS Visual Studio Developer Tools ? Thank you!Microsoft's Build 2012 sells out in an hour个人买Visual Studio 2012要多少钱Visual Studio 2012 and .net 4.5 Release candidate available for downloadCode review问个MVC3的问题How : asp.net C# applcation notification message from server to client, Please!有没有LA的,用c#做数据开发的,想当面请教一些经验请推荐一本 .net web site 的入门书how to use window authentication in the ASP.net? Thank you!如何让Razor view engine可以渲染htm/html文件.net 有没有folding/collapsing控件学习Python的网上课程,stanford