postmessage 能不能模拟发送鼠标移动的消息?
postmessage 能不能模拟发送鼠标移动的消息?
不是要改变鼠标的位置,只是想给一个按钮发送鼠标经过的消息,不知道能不能实现
[解决办法]
不解楼主之意。。。
[解决办法]
Option ExplicitPrivate Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As LongPrivate Declare Function ReleaseCapture Lib "user32" () As LongPrivate Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 0 Then If (X < 0) Or (Y < 0) Or (X > Command1.Width) Or (Y > Command1.Height) Then ReleaseCapture ' 放入鼠标离开的代码 Command1.Caption = "鼠标离开" Else SetCapture Command1.hWnd ' 放入鼠标进入的代码 Command1.Caption = "鼠标进入" End If End IfEnd Sub
[解决办法]
我看你还是使用SetCursorPos来设置鼠标的位置为最佳方法。
[解决办法]
SetCursorPos 正解!
[解决办法]
发WM_MOUSEMOVE试下.