^_^试试在窗体中点击鼠标左键! Option ExplicitPrivate Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Type POINTAPI X As Long Y As Long End TypePrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim tP As POINTAPI
GetCursorPos tP Call mouse_event(&H10, tP.X, tP.Y, 0, 0) End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then MsgBox "OK" End If End Sub
使用sendkeys即可让屏幕自动响应鼠标右键???
不明白
让屏幕自动响应鼠标右键???
不明白
----------------------------------
就是说让程序自己执行鼠标右键?
?让屏幕自动响应鼠标右键,总要有个条件吧,就是何时响应,你试试用个time控件,定时响应,
Option ExplicitPrivate Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End TypePrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim tP As POINTAPI
GetCursorPos tP
Call mouse_event(&H10, tP.X, tP.Y, 0, 0)
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
MsgBox "OK"
End If
End Sub