VB键盘鼠标问题
按下commbox1则生成一个事件:按下键盘上的F9键按下combox2在屏幕坐标为100,100的地方按下鼠标左键回答一个是一个也给分QQ497639702http:/...
按下commbox1
则生成一个事件:按下键盘上的F9键
按下combox2
在屏幕坐标为100,100的地方按下鼠标左键
回答一个是一个 也给分
QQ497639702
http://zhidao.baidu.com/question/38193885.html
连这个连接一起给分 谢谢啊 展开
则生成一个事件:按下键盘上的F9键
按下combox2
在屏幕坐标为100,100的地方按下鼠标左键
回答一个是一个 也给分
QQ497639702
http://zhidao.baidu.com/question/38193885.html
连这个连接一起给分 谢谢啊 展开
5个回答
展开全部
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
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 Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Load()
Me.Move 0, 0
Command1.Caption = "按F9键"
Command2.Caption = "点击左键"
End Sub
Private Sub Command2_Click()
Sleep 5 '停5秒
SetCursorPos 100, 100
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Command1_Click()
SendKeys "{F9}", True
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
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 Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Load()
Me.Move 0, 0
Command1.Caption = "按F9键"
Command2.Caption = "点击左键"
End Sub
Private Sub Command2_Click()
Sleep 5 '停5秒
SetCursorPos 100, 100
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Command1_Click()
SendKeys "{F9}", True
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command2_Click()
Sleep 5 '停5秒 ''' 这是暂停5毫秒。。。。
SetCursorPos 100, 100
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Command2_Click()
Sleep 5 '停5秒 ''' 这是暂停5毫秒。。。。
SetCursorPos 100, 100
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1\可以用sendkey吧
2\可以用程序移动鼠标,在调用单击事件
2\可以用程序移动鼠标,在调用单击事件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
都回答了,我就不回答拉
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
请问真的有必要用到API吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询