postmessage 能不能模拟发送鼠标移动的消息?
postmessage 能不能模拟发送鼠标移动的消息?
不是要改变鼠标的位置,只是想给一个按钮发送鼠标经过的消息,不知道能不能实现
[解决办法]
不解楼主之意。。。
[解决办法]
Option Explicit
Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private 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 If
End Sub