我知道之前已经问过这个问题,但没有人回答我的问题,因为所有其他人都使用(x,y)协调。我想知道是否有一种方法可以不必专注于窗口而模拟鼠标点击该窗口按钮,所有这些都只需要按钮hWnd。 这是我正在使用的代码,但它不会起作用。
Declare Auto Function SendMessage Lib "user32.dll" _
(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
Sub ClearCon()
Dim PARENThwnd As IntPtr
Dim CHILDhwnd As IntPtr
PARENThwnd = FindWindow(Nothing, "ET Console")
CHILDhwnd = FindWindowEx(PARENThwnd, Nothing, "Button", "Clear")
SendMessage(CHILDhwnd, WM_LBUTTONDOWN, IntPtr.Zero, IntPtr.Zero)
SendMessage(CHILDhwnd, WM_LBUTTONUP, IntPtr.Zero, IntPtr.Zero)
End Sub
这是我在SendMessage函数上看到的错误:
SendMessage Argument not specified for parameter 'hWnd' of 'Public Shared Function SendMessage(hWnd As System.IntPtr, msg As Integer, wParam As System.IntPtr, lParam As System.IntPtr) As System.IntPtr'.
我做错了什么?