VB如何设置点击鼠标左键
如何设置鼠标左键点了一次后则出现2次鼠标点击?这个效果怎么做?外带还要做个热键。还有。。我要的是代码。。谢谢勒~...
如何设置鼠标左键点了一次后则出现2次鼠标点击?
这个效果怎么做?
外带还要做个热键。
还有。。我要的是代码。。
谢谢勒~ 展开
这个效果怎么做?
外带还要做个热键。
还有。。我要的是代码。。
谢谢勒~ 展开
展开全部
下面是模拟窗体的双击事件
Private 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 Const MOUSEEVENTF_LEFTDOWN = &H2 '模拟鼠标左键按下
Private Const MOUSEEVENTF_LEFTUP = &H4 '虚迹物模拟鼠标左键抬起
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_dblClick()
MsgBox "双击"
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyA Then '按下A即是双击了窗体,即触发了form的dblclick事州岩件,A为热键
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If
If KeyCode = vbKeyQ Then ' 按下Q结束程序
End
End If
End Sub
Private Sub Timer1_Timer()
SetCursorPos (Me.Left + 1000) / Screen.TwipsPerPixelX, (Me.Top + 1000) / Screen.TwipsPerPixelY ' 设置鼠标的位置在窗差液体上
End Sub
Private 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 Const MOUSEEVENTF_LEFTDOWN = &H2 '模拟鼠标左键按下
Private Const MOUSEEVENTF_LEFTUP = &H4 '虚迹物模拟鼠标左键抬起
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_dblClick()
MsgBox "双击"
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyA Then '按下A即是双击了窗体,即触发了form的dblclick事州岩件,A为热键
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If
If KeyCode = vbKeyQ Then ' 按下Q结束程序
End
End If
End Sub
Private Sub Timer1_Timer()
SetCursorPos (Me.Left + 1000) / Screen.TwipsPerPixelX, (Me.Top + 1000) / Screen.TwipsPerPixelY ' 设置鼠标的位置在窗差液体上
End Sub
参考资料: 自己
展开全部
下面是模拟窗体的双击事件
Private 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 Const MOUSEEVENTF_LEFTDOWN = &H2 '模拟鼠标左键按下
Private Const MOUSEEVENTF_LEFTUP = &H4 '虚迹物模拟鼠标左键抬起
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_dblClick()
MsgBox "双击"
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyA Then '按下A即是双击了窗体,即触发了form的dblclick事州岩件,A为热键
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If
If KeyCode = vbKeyQ Then ' 按下Q结束程序
End
End If
End Sub
Private Sub Timer1_Timer()
SetCursorPos (Me.Left + 1000) / Screen.TwipsPerPixelX, (Me.Top + 1000) / Screen.TwipsPerPixelY ' 设置鼠标的位置在窗差液体上
End Sub
Private 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 Const MOUSEEVENTF_LEFTDOWN = &H2 '模拟鼠标左键按下
Private Const MOUSEEVENTF_LEFTUP = &H4 '虚迹物模拟鼠标左键抬起
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_dblClick()
MsgBox "双击"
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyA Then '按下A即是双击了窗体,即触发了form的dblclick事州岩件,A为热键
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If
If KeyCode = vbKeyQ Then ' 按下Q结束程序
End
End If
End Sub
Private Sub Timer1_Timer()
SetCursorPos (Me.Left + 1000) / Screen.TwipsPerPixelX, (Me.Top + 1000) / Screen.TwipsPerPixelY ' 设置鼠标的位置在窗差液体上
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询