应用程序按钮上的SendMessage BM_CLICK

时间:2013-07-14 22:10:09

标签: vb.net sendmessage user32 findwindow findwindowex

嘿,所有人都对这个BM_CLICK问题的影响感到困惑。

这是我的代码:

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, <MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer

Dim hwndParent As Long = FindWindow(vbNullString, "Video Source")
  Debug.Print("findwindow: " & hwndParent)
Dim hwndButton As Long = FindWindowEx(hwndParent, IntPtr.Zero, "Button", "OK")
  Debug.Print("OK: " & hwndButton)
hwndButton = SendMessage(hwndButton, BM_CLICK, 0, 0)
  Debug.Print("Clicked: " & hwndButton)

调试输出为:

findwindow: 856318
        OK: 1052904
   Clicked: 0

现在我不知道它为什么找不到也没点击OK按钮。

该按钮的Spy ++如下所示:

enter image description here

任何帮助都会很棒!

0 个答案:

没有答案