vb 控制鼠标按要求移动。
发布网友
发布时间:2023-07-12 00:56
我来回答
共2个回答
热心网友
时间:2024-10-25 20:25
按照时间间隔分次执行的话可以用TImer控件来控制,你在做QQ视频攻击器??
热心网友
时间:2024-10-25 20:25
'读取鼠标位置
Dim
p
As
POINTAPI
Call
GetCursorPos(p)
MsgBox
"当前鼠标位置为:"
+
vbCrLf
+
"X坐标:"
+
LTrim(Str(p.x))
+
vbCrLf
+
"Y坐标:"
+
LTrim(Str(p.y))
'控制鼠标位置
SetCursorPos
X,
Y
'分别是X坐标和Y坐标
'左键落下
mouse_event
MOUSEEVENTF_LEFTDOWN,
0,
0,
0,
0
'左键抬起
mouse_event
MOUSEEVENTF_LEFTUP,
0,
0,
0,
0
'右键落下
mouse_event
MOUSEEVENTF_RIGHTDOWN,
0,
0,
0,
0
'右键抬起
mouse_event
MOUSEEVENTF_RIGHTUP,
0,
0,
0,
0
要用的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
Declare
Function
SetCursorPos
Lib
"user32"
(ByVal
x
As
Long,
ByVal
y
As
Long)
As
Long
Public
Declare
Sub
Sleep
Lib
"kernel32"
(ByVal
dwMilliseconds
As
Long)
Public
Declare
Function
GetCursorPos
Lib
"user32"
(lpPoint
As
POINTAPI)
As
Long
Public
Declare
Sub
keybd_event
Lib
"user32"
(ByVal
bVk
As
Byte,
ByVal
bScan
As
Byte,
ByVal
dwFlags
As
Long,
ByVal
dwExtraInfo
As
Long)
Public
Const
MOUSEEVENTF_MOVE
=
&H1
'
mouse
move
Public
Const
MOUSEEVENTF_LEFTDOWN
=
&H2
'
left
button
down
Public
Const
MOUSEEVENTF_LEFTUP
=
&H4
'
left
button
up
Public
Const
MOUSEEVENTF_RIGHTDOWN
=
&H8
'
right
button
down
Public
Const
MOUSEEVENTF_RIGHTUP
=
&H10
'
right
button
up
Public
Type
POINTAPI
x
As
Long
y
As
Long
End
Type
下回问之前先查查哦!
热心网友
时间:2024-10-25 20:25
按照时间间隔分次执行的话可以用TImer控件来控制,你在做QQ视频攻击器??
热心网友
时间:2024-10-25 20:26
'读取鼠标位置
Dim
p
As
POINTAPI
Call
GetCursorPos(p)
MsgBox
"当前鼠标位置为:"
+
vbCrLf
+
"X坐标:"
+
LTrim(Str(p.x))
+
vbCrLf
+
"Y坐标:"
+
LTrim(Str(p.y))
'控制鼠标位置
SetCursorPos
X,
Y
'分别是X坐标和Y坐标
'左键落下
mouse_event
MOUSEEVENTF_LEFTDOWN,
0,
0,
0,
0
'左键抬起
mouse_event
MOUSEEVENTF_LEFTUP,
0,
0,
0,
0
'右键落下
mouse_event
MOUSEEVENTF_RIGHTDOWN,
0,
0,
0,
0
'右键抬起
mouse_event
MOUSEEVENTF_RIGHTUP,
0,
0,
0,
0
要用的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
Declare
Function
SetCursorPos
Lib
"user32"
(ByVal
x
As
Long,
ByVal
y
As
Long)
As
Long
Public
Declare
Sub
Sleep
Lib
"kernel32"
(ByVal
dwMilliseconds
As
Long)
Public
Declare
Function
GetCursorPos
Lib
"user32"
(lpPoint
As
POINTAPI)
As
Long
Public
Declare
Sub
keybd_event
Lib
"user32"
(ByVal
bVk
As
Byte,
ByVal
bScan
As
Byte,
ByVal
dwFlags
As
Long,
ByVal
dwExtraInfo
As
Long)
Public
Const
MOUSEEVENTF_MOVE
=
&H1
'
mouse
move
Public
Const
MOUSEEVENTF_LEFTDOWN
=
&H2
'
left
button
down
Public
Const
MOUSEEVENTF_LEFTUP
=
&H4
'
left
button
up
Public
Const
MOUSEEVENTF_RIGHTDOWN
=
&H8
'
right
button
down
Public
Const
MOUSEEVENTF_RIGHTUP
=
&H10
'
right
button
up
Public
Type
POINTAPI
x
As
Long
y
As
Long
End
Type
下回问之前先查查哦!