vb 模拟鼠标按键
把鼠标移到屏幕指定位置如(111.111)单击一下再移到屏幕另一指定位置指定位置如(222.222)单击一下希望哪位高手教教我要调用api函数但是我不会麻烦把做好的程序(...
把鼠标移到屏幕指定位置 如(111.111) 单击一下
再移到屏幕另一指定位置指定位置 如(222.222)单击一下
希望哪位高手教教我 要调用api函数
但是我不会
麻烦把做好的程序(含代码)发到我邮箱419317946@qq.com 或直接用qq聊
成功后再送100分奖赏 展开
再移到屏幕另一指定位置指定位置 如(222.222)单击一下
希望哪位高手教教我 要调用api函数
但是我不会
麻烦把做好的程序(含代码)发到我邮箱419317946@qq.com 或直接用qq聊
成功后再送100分奖赏 展开
展开全部
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 Sub Command1_Click()
Timer1.Enabled = True
Timer2.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer2.Interval = 1000
Timer1.Enabled = False
Timer2.Enabled = False
End Sub
Private Sub Timer1_Timer()
Call SetCursorPos(111, 111) '让鼠标移动到(111,111)
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Timer2_Timer()
Call SetCursorPos(2222, 2222) '让鼠标移动到(2222,2222)
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Sub Command1_Click()
Timer1.Enabled = True
Timer2.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer2.Interval = 1000
Timer1.Enabled = False
Timer2.Enabled = False
End Sub
Private Sub Timer1_Timer()
Call SetCursorPos(111, 111) '让鼠标移动到(111,111)
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Timer2_Timer()
Call SetCursorPos(2222, 2222) '让鼠标移动到(2222,2222)
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
--
2022-12-05 广告
2022-12-05 广告
图形化编程简单理解为用积木块形式编程,scratch和python也是其中的一种,属于入门级编程,以其简单生动的画面获得无数学生的喜爱,深圳市创客火科技有限公司是一家做教育无人机的公司,旗下有编程无人机,积木无人机及室内外编队,每款飞机含有...
点击进入详情页
本回答由--提供
展开全部
什么意思啊
点一西啊就OK了
点一西啊就OK了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这是我写在空间里面的一部分代码,复制给你吧.
这个是类似按键精灵的一个简单移动代码,要模拟按键,可在VB自带的API查看中,找到鼠标常数的声明加入标准模块.在调用中加入相关的参数即可.
以下是API函数声明(请写在标准模块里面):
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 Const MOUSEEVENTF_ABSOLUTE = &H8000
Declare Function SetCursorPos Lib "User32" (ByVal X As Long, ByVal Y As Long) As Long
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_MOVE = &H1
调用方法(在需要模拟的过程里加入):
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 9000, 1000, 0, 0
'Call SetCursorPos(355, 556)'这是一种方法,中间的数字为窗口屏幕坐标
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 19000, 11000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 12000, 41000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 12000, 51000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 29000, 21000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 39000, 31000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 49000, 41000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 59000, 51000, 0, 0
API其实很好用,只要你沉下心去,看懂他的参数与说明.不要被一长串的参数与字符吓倒了.
(原创)
这个是类似按键精灵的一个简单移动代码,要模拟按键,可在VB自带的API查看中,找到鼠标常数的声明加入标准模块.在调用中加入相关的参数即可.
以下是API函数声明(请写在标准模块里面):
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 Const MOUSEEVENTF_ABSOLUTE = &H8000
Declare Function SetCursorPos Lib "User32" (ByVal X As Long, ByVal Y As Long) As Long
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_MOVE = &H1
调用方法(在需要模拟的过程里加入):
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 9000, 1000, 0, 0
'Call SetCursorPos(355, 556)'这是一种方法,中间的数字为窗口屏幕坐标
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 19000, 11000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 12000, 41000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 12000, 51000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 29000, 21000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 39000, 31000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 49000, 41000, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, 59000, 51000, 0, 0
API其实很好用,只要你沉下心去,看懂他的参数与说明.不要被一长串的参数与字符吓倒了.
(原创)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询