VB用SendMessage第四个参数精确模拟鼠标单击的代码
PublicDeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(_ &nb...
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _ ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ lParam As Any) As Long想让第四个参数前0-15位存X坐标值,16-31位存Y坐标值.Private Sub cmdClick_Click() Dim Pos As String Dim r1 As RECT GetWindowRect GameHwnd, r1 Pos = Right("0000" & Hex(187 + r1.Top), 4) & Right("0000" & Hex(22 + r1.Left), 4) '187和22是一个固定坐标,这里主要把Pos的前4位放Y坐标,后四位放X坐标。 SendMessage GameHwnd, WM_LBUTTONDOWN, 0, val( "&H" & Pos) SendMessage GameHwnd, WM_LBUTTONUP, 0, val( "&H" & Pos)End Sub这个模拟程序有问题吗?我把SendMessage最后一个参数改成Long型也没成功.
展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询