十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
调用api
网站建设公司,为您提供网站建设,网站制作,网页设计及定制网站建设服务,专注于成都企业网站建设,高端网页制作,对成都玻璃隔断等多个行业拥有丰富的网站建设经验的网站建设公司。专业网站设计,网站优化推广哪家好,专业seo优化优化,H5建站,响应式网站。
在Visual Baisc.net中的声明:
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_LEFTDOWN = H2 '模拟鼠标左键按下
Public Const MOUSEEVENTF_LEFTUP = H4 ’模拟鼠标左键释放
Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模拟鼠标中间键按下
Public Const MOUSEEVENTF_MIDDLEUP = H40 '模拟鼠标中间键释放
Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模拟鼠标右键按下
Public Const MOUSEEVENTF_RIGHTUP = H10 '模拟鼠标右键释放
Public Const MOUSEEVENTF_MOVE = H1 '模拟鼠标指针移动
例:
mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0
'在(10,10)模拟鼠标左键按下
Private
Declare
Function
SetCursorPos
Lib
"user32"
(ByVal
x
As
Long,
ByVal
y
As
Long)
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
Const
MOUSEEVENTF_LEFTDOWN
=
H2
Private
Const
MOUSEEVENTF_LEFTUP
=
H4
Private
Sub
Command1_Click()
Timer1.Interval
=
1000
Timer1.Enabled
=
True
End
Sub
Private
Sub
Timer1_Timer()
Dim
a
As
Integer
Static
b
As
Integer
'
a
=
Val(Text1.Text)
'
b
=
'
Do
Until
b
=
a
b
=
b
+
1
SetCursorPos
400,
400
mouse_event
MOUSEEVENTF_LEFTDOWN,
0,
0,
0,
mouse_event
MOUSEEVENTF_LEFTUP,
0,
0,
0,
"click
"
b
'
Loop
If
b
=
Val(Text1.Text)
Then
Timer1.Enabled
=
False:
b
=
End
Sub
调用api
在Visual Baisc.net中的声明:
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_LEFTDOWN = H2 '模拟鼠标左键按下
Public Const MOUSEEVENTF_LEFTUP = H4 ’模拟鼠标左键释放
Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模拟鼠标中间键按下
Public Const MOUSEEVENTF_MIDDLEUP = H40 '模拟鼠标中间键释放
Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模拟鼠标右键按下
Public Const MOUSEEVENTF_RIGHTUP = H10 '模拟鼠标右键释放
Public Const MOUSEEVENTF_MOVE = H1 '模拟鼠标指针移动
例:
mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0
'在(10,10)模拟鼠标左键按下
vb我不是很会,我给你说个思路吧。timer控件设定计时开始和速度,假设为一秒一下。在timer事件中调用button的单击事件,当然timer中还需要定义一个变量,用来做自增运算,一遍计算运行的时间。当变量到100后,弹出窗口提示完成,timer控件停止就行了。如果还是不明白我可以给你编个c#的代码,只要是vb的语法不是很会。