怎样用VB代码实现鼠标单击的效果
答案:1 悬赏:0 手机版
解决时间 2021-03-28 03:07
- 提问者网友:喧嚣尘世
- 2021-03-27 09:12
怎样用VB代码实现鼠标单击的效果
最佳答案
- 五星知识达人网友:怀裏藏嬌
- 2021-03-27 09:34
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
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
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯