怎样用VB代码实现鼠标单击的效果
展开全部
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public 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)
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Sub DS()
X = 300 '(Me.Left + Combo1.Left + Combo1.Width - 15) / 15
Y = 500 '(Me.Top + Combo1.Top + Combo1.Height * 2 - 15) / 15
SetCursorPos X, Y
mouse_event MOUSEEVENTF_LEFTDOWN, X, Y, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, X, Y, 0, 0
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询