请帮我用VB来编写一个鼠标自动点击的代码

如题所述

第1个回答  2019-08-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
=
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
第2个回答  2010-05-24
利用cammand按钮和timer控件 鼠标移动到哪都是自动单击左键 右击 单击 右击如此循环 时间间隔0秒点击command1开始 再点一下本回答被提问者采纳
第3个回答  2010-05-24
用按键精灵啦
第4个回答  2010-05-24
我有啊
留QQ,我给你发过去

请帮我用VB来编写一个鼠标自动点击的代码
Val(Text1.Text)'b

如何用VB写个鼠标自动点开始 单击开始
在form里加上一个command和timer控件,然后代码如下: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)Const MOUSEEVENTF_LEFTDOWN = &H2 Const MOUSEEVENTF_LEFTUP = &H4 Pr...

VB編寫鼠標自動移動點擊左鍵
还有一个设置鼠标移动到某个点上. Dim p As PointAPI SetCursorPos p 'p.x=? p.y=? 自己设置 记得采纳啊

VB中如何把鼠标自动移到指定位置并单击?
单击Command1时鼠标会到(500,500)这个点作鼠标左键单击动作代码如下: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, By...

VB实现自动单击鼠标左键的代码是什么?
resource1: dword = 1940000000;ResourceOffset2: dword = $0043FA50;resource2: dword = 1280185;ResourceOffset3: dword = $0043FA54;resource3: dword = 3163064576;ResourceOffset4: dword = $0043FA58;resource4: dword = ...

VB实现自动单击鼠标左键的代码是什么?
1. mouse_event 函数功能:该函数综合鼠标击键和鼠标动作。在Windows NT\/2000\/XP中,该函数已经被取消,使用SendInput函数代替。 函数原型: VOID mouse_event( DWORD dwFlags, \/\/ motion and click options DWORD dx, \/\/ horizontal position or change DWORD dy, \/\/ vertical position or change ...

VB怎么实现鼠标移动过去执行一个命令按下去又执行另一命令?
以一个文本框控件(Text1)为例:Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)Debug.Print "这是鼠标按下去执行的命令"End Sub Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)Debug.Print "这...

如何用VB做鼠标连续点击左键
Private Sub Command1_Click()Timer1.Enabled = True End Sub Private Sub Command2_Click()Timer1.Enabled = False End Sub Private Sub Timer1_Timer()Dim x, y '我这里使用绝对坐标,单位像素,举例为(100,100),想要在哪里点击自己设定 x = 100 * 65536 \/ (Screen.Width \/ Screen....

vb如何模拟鼠标每隔一段时间自动点击一个固定的位置?
下面是源代码,已经过测试,可直接复制到VB内.在form1上创建一个Timer,起名为Timer1,将其Interval设置成1000;创建一个按钮,为command1,用以测试;--- Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, B...

VB编程,如何实现鼠标光标自动在文本输入框里面?
实现鼠标光标自动在文本输入框内部的VB编程操作相当直接。首先,你需要在程序启动时的首个执行点编写代码。这个点就是窗体加载事件,通过在"Form_Load()"事件中添加相应代码来完成。具体操作如下:输入"Textbox1.SetFocus"语句。这句代码的功能是将焦点设置在名为"Textbox1"的文本框上。当程序启动后,...

相似回答
大家正在搜