怎么用Windows API模拟鼠标移动事件
1个回答
展开全部
具体代码如下:
PutAttachment "d:\p", "*.*"
//获取窗口句柄
Hwnd = Plugin.Window.MousePoint()
//获取窗口客户区左上角坐标
sRect = Plugin.Window.GetClientRect(Hwnd)
xyArray = Split(sRect, "|", - 1 , 1)
dx = xyArray(0)
dy = xyArray(1)
//转移窗口
KMData = Plugin.bgkms6_10.KMTransform(hwnd, 0)
//Plugin.BGCP2_02.TransformWindow 参数1
//加载图片
tu = Plugin.BGCP2_02.LoadBMP("d:\p\4.bmp")
tu1 = Plugin.BGCP2_02.LoadBMP("d:\p\12.bmp")
Do
Call Plugin.Bkgnd.KeyPress(Hwnd, 9)
Delay 100
Call Plugin.Bkgnd.KeyPress(Hwnd, 49)
Delay 3000
For 60
Call Plugin.BGCP2_02.FindPicture(hwnd, 0, 0, 1024, 768 ,tu(0), 30, 0.9, ipX, ipY)
If ipX > 0 And ipY > 0 Then
Call Plugin.Bkgnd.KeyPress(Hwnd, 51)
Delay 1000
Call Plugin.BGCP2_02.FindPicture(hwnd, 0, 0, 1024, 768 ,tu1(0), 30, 0.9, intX, intY)
If intX > 0 And intY > 0 Then
Call Plugin.bgkms6_10.MoveTo(KMData, intX, intY) //
Delay 1000
call Plugin.bgkms6_10.LeftClick (KMData) //这里后台点击鼠标左击没反应
Delay 200
End If
End If
//End If
Next
Delay 100
Loop
Sub OnScriptExit
//释放转移窗口
Call Plugin.BGCP2_02.UnTransformWindow(Hwnd)
call Plugin.bgkms6_10.KMUntransform (KMData)
End Sub
PutAttachment "d:\p", "*.*"
//获取窗口句柄
Hwnd = Plugin.Window.MousePoint()
//获取窗口客户区左上角坐标
sRect = Plugin.Window.GetClientRect(Hwnd)
xyArray = Split(sRect, "|", - 1 , 1)
dx = xyArray(0)
dy = xyArray(1)
//转移窗口
KMData = Plugin.bgkms6_10.KMTransform(hwnd, 0)
//Plugin.BGCP2_02.TransformWindow 参数1
//加载图片
tu = Plugin.BGCP2_02.LoadBMP("d:\p\4.bmp")
tu1 = Plugin.BGCP2_02.LoadBMP("d:\p\12.bmp")
Do
Call Plugin.Bkgnd.KeyPress(Hwnd, 9)
Delay 100
Call Plugin.Bkgnd.KeyPress(Hwnd, 49)
Delay 3000
For 60
Call Plugin.BGCP2_02.FindPicture(hwnd, 0, 0, 1024, 768 ,tu(0), 30, 0.9, ipX, ipY)
If ipX > 0 And ipY > 0 Then
Call Plugin.Bkgnd.KeyPress(Hwnd, 51)
Delay 1000
Call Plugin.BGCP2_02.FindPicture(hwnd, 0, 0, 1024, 768 ,tu1(0), 30, 0.9, intX, intY)
If intX > 0 And intY > 0 Then
Call Plugin.bgkms6_10.MoveTo(KMData, intX, intY) //
Delay 1000
call Plugin.bgkms6_10.LeftClick (KMData) //这里后台点击鼠标左击没反应
Delay 200
End If
End If
//End If
Next
Delay 100
Loop
Sub OnScriptExit
//释放转移窗口
Call Plugin.BGCP2_02.UnTransformWindow(Hwnd)
call Plugin.bgkms6_10.KMUntransform (KMData)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询