【发布时间】:2014-03-22 16:08:14
【问题描述】:
我正在尝试单击最小化应用程序中的按钮,我使用此代码
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Dim ParenthWnd As New IntPtr(0)
Dim hWnd As New IntPtr(0)
ParenthWnd = FindWindow(Nothing, "Title of application")
If ParenthWnd.Equals(IntPtr.Zero) Then
Debug.WriteLine(""Title of application" is not running")
Else
hWnd = FindWindowEx(ParenthWnd, hWnd, "Button", "Login")
If hWnd.Equals(IntPtr.Zero) Then
Debug.WriteLine(""Title of application" doesn't have a 'Login' button, how strange!")
Else
Debug.WriteLine(""Title of application" Window: " & ParenthWnd.ToString())
Debug.WriteLine("Button Control: " & hWnd.ToString())
SendMessage(hWnd, WM_LBUTTONDOWN, 1, 0)
SendMessage(hWnd, WM_LBUTTONUP, 0, 0)
End If
End If
我在调试窗口中得到了一个真实的结果:
"title of window" Window: 2492018
Button Control: 1836764
但它仍然只是“标记”按钮而不点击它,有人知道我应该改变什么吗?
【问题讨论】:
标签: vb.net sendmessage