请帮我用VB来编写一个鼠标自动点击的代码
4个回答
展开全部
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
=
0
'
Do
Until
b
=
a
b
=
b
+
1
SetCursorPos
400,
400
mouse_event
MOUSEEVENTF_LEFTDOWN,
0,
0,
0,
0
mouse_event
MOUSEEVENTF_LEFTUP,
0,
0,
0,
0
Print
"click
"
&
b
'
Loop
If
b
>=
Val(Text1.Text)
Then
Timer1.Enabled
=
False:
b
=
0
End
Sub
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
=
0
'
Do
Until
b
=
a
b
=
b
+
1
SetCursorPos
400,
400
mouse_event
MOUSEEVENTF_LEFTDOWN,
0,
0,
0,
0
mouse_event
MOUSEEVENTF_LEFTUP,
0,
0,
0,
0
"click
"
&
b
'
Loop
If
b
>=
Val(Text1.Text)
Then
Timer1.Enabled
=
False:
b
=
0
End
Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2010-05-24
展开全部
利用cammand按钮和timer控件 鼠标移动到哪都是自动单击左键 右击 单击 右击如此循环 时间间隔0秒点击command1开始 再点一下
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用按键精灵啦
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我有啊
留QQ,我给你发过去
留QQ,我给你发过去
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |