找一个VB或者bat批处理程序能够实现控制鼠标的
找一个VB或者bat批处理程序能够实现控制鼠标的隔4小时重复运行把鼠标放在坐标x1y1的位置单击两次重复急求QQ:271926729试过按键精灵。但是服务器上面使用按键精...
找一个VB或者bat批处理程序能够实现控制鼠标的
隔4小时重复运行把鼠标放在坐标x1 y1的位置单击两次 重复
急求 QQ:271926729
试过按键精灵。但是服务器上面使用按键精灵在不连接到服务器的情况下是没法用的哦。。 展开
隔4小时重复运行把鼠标放在坐标x1 y1的位置单击两次 重复
急求 QQ:271926729
试过按键精灵。但是服务器上面使用按键精灵在不连接到服务器的情况下是没法用的哦。。 展开
4个回答
展开全部
鼠标专用类模块
Option Explicit
DefLng A-Z
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private CurVisible As Boolean
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 GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function ClipCursor Lib "user32" (lpRect As RECT) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Public Sub LeftButtonDown()
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
End Sub
Public Sub LeftButtonUp()
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
Public Sub RightButtonDown()
Call mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
End Sub
Public Sub RightButtonUp()
Call mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
End Sub
Public Property Get X() As Long
Dim tmpPoint As POINTAPI
Call GetCursorPos(tmpPoint)
X = tmpPoint.X
End Property
Public Property Let X(ByVal vNewValue As Long)
Call SetCursorPos(vNewValue, Y)
End Property
Public Property Get Y() As Long
Dim tmpPoint As POINTAPI
Call GetCursorPos(tmpPoint)
Y = tmpPoint.Y
End Property
Public Property Let Y(ByVal vNewValue As Long)
Call SetCursorPos(X, vNewValue)
End Property
Public Sub SnapTo(ctl As Control)
Dim pnt As POINTAPI
Dim xx As Long
Dim yy As Long
pnt.X = pnt.Y = 0
'Get Left-Top corner of control
Call ClientToScreen(ctl.hWnd, pnt)
xx = pnt.X + (ctl.Width \ 2)
yy = pnt.Y + (ctl.Height \ 2)
'xx = pnt.X + ctl.Width / (2 * (Screen.ActiveForm.Left + ctl.Left) / pnt.X)
'yy = pnt.Y + ctl.Height / (2 * (Screen.ActiveForm.Top + ctl.Top) / pnt.Y)
Call SetCursorPos(xx, yy)
End Sub
Public Sub ClipTo(ToCtl As Object)
On Error Resume Next
Dim tmpRect As RECT
Dim pt As POINTAPI
With ToCtl
If TypeOf ToCtl Is Form Then
tmpRect.Left = (.Left \ Screen.TwipsPerPixelX)
tmpRect.Top = (.Top \ Screen.TwipsPerPixelY)
tmpRect.Right = (.Left + .Width) \ Screen.TwipsPerPixelX
tmpRect.Bottom = (.Top + .Height) \ Screen.TwipsPerPixelY
ElseIf TypeOf ToCtl Is Screen Then
tmpRect.Left = 0
tmpRect.Top = 0
tmpRect.Right = (.Width \ Screen.TwipsPerPixelX)
tmpRect.Bottom = (.Height \ Screen.TwipsPerPixelY)
Else
pt.X = 0
pt.Y = 0
Call ClientToScreen(.hWnd, pt)
tmpRect.Left = pt.X
tmpRect.Top = pt.Y
pt.X = .Width
pt.Y = .Height
Call ClientToScreen(.hWnd, pt)
tmpRect.Bottom = pt.Y
tmpRect.Right = pt.X
End If
Call ClipCursor(tmpRect)
End With
End Sub
Private Sub Class_Initialize()
CurVisible = True
End Sub
Public Property Get Visible() As Boolean
Visible = CurVisible
End Property
Public Property Let Visible(ByVal vNewValue As Boolean)
CurVisible = vNewValue
Call ShowCursor(CurVisible)
End Property
……………………………………………………………………………………………
程序这样写:
dim a as new class1
a.x=x1
a.y=y1
a.LeftButtonUp
a.LeftButtondown
a.LeftButtonUp
a.LeftButtondown
Option Explicit
DefLng A-Z
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private CurVisible As Boolean
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 GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function ClipCursor Lib "user32" (lpRect As RECT) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Public Sub LeftButtonDown()
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
End Sub
Public Sub LeftButtonUp()
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
Public Sub RightButtonDown()
Call mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
End Sub
Public Sub RightButtonUp()
Call mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
End Sub
Public Property Get X() As Long
Dim tmpPoint As POINTAPI
Call GetCursorPos(tmpPoint)
X = tmpPoint.X
End Property
Public Property Let X(ByVal vNewValue As Long)
Call SetCursorPos(vNewValue, Y)
End Property
Public Property Get Y() As Long
Dim tmpPoint As POINTAPI
Call GetCursorPos(tmpPoint)
Y = tmpPoint.Y
End Property
Public Property Let Y(ByVal vNewValue As Long)
Call SetCursorPos(X, vNewValue)
End Property
Public Sub SnapTo(ctl As Control)
Dim pnt As POINTAPI
Dim xx As Long
Dim yy As Long
pnt.X = pnt.Y = 0
'Get Left-Top corner of control
Call ClientToScreen(ctl.hWnd, pnt)
xx = pnt.X + (ctl.Width \ 2)
yy = pnt.Y + (ctl.Height \ 2)
'xx = pnt.X + ctl.Width / (2 * (Screen.ActiveForm.Left + ctl.Left) / pnt.X)
'yy = pnt.Y + ctl.Height / (2 * (Screen.ActiveForm.Top + ctl.Top) / pnt.Y)
Call SetCursorPos(xx, yy)
End Sub
Public Sub ClipTo(ToCtl As Object)
On Error Resume Next
Dim tmpRect As RECT
Dim pt As POINTAPI
With ToCtl
If TypeOf ToCtl Is Form Then
tmpRect.Left = (.Left \ Screen.TwipsPerPixelX)
tmpRect.Top = (.Top \ Screen.TwipsPerPixelY)
tmpRect.Right = (.Left + .Width) \ Screen.TwipsPerPixelX
tmpRect.Bottom = (.Top + .Height) \ Screen.TwipsPerPixelY
ElseIf TypeOf ToCtl Is Screen Then
tmpRect.Left = 0
tmpRect.Top = 0
tmpRect.Right = (.Width \ Screen.TwipsPerPixelX)
tmpRect.Bottom = (.Height \ Screen.TwipsPerPixelY)
Else
pt.X = 0
pt.Y = 0
Call ClientToScreen(.hWnd, pt)
tmpRect.Left = pt.X
tmpRect.Top = pt.Y
pt.X = .Width
pt.Y = .Height
Call ClientToScreen(.hWnd, pt)
tmpRect.Bottom = pt.Y
tmpRect.Right = pt.X
End If
Call ClipCursor(tmpRect)
End With
End Sub
Private Sub Class_Initialize()
CurVisible = True
End Sub
Public Property Get Visible() As Boolean
Visible = CurVisible
End Property
Public Property Let Visible(ByVal vNewValue As Boolean)
CurVisible = vNewValue
Call ShowCursor(CurVisible)
End Property
……………………………………………………………………………………………
程序这样写:
dim a as new class1
a.x=x1
a.y=y1
a.LeftButtonUp
a.LeftButtondown
a.LeftButtonUp
a.LeftButtondown
展开全部
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Const WM_MBUTTONDOWN = &H207
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 Timer1_Timer() '来一个计时四小时来一次
Static i As Integer
i = i + 1
If i = 14400 Then
SetCursorPos 314, 185 '这是里的两个参数是你想要点的坐标改下就可以了啊0`
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '模拟鼠标的左键单击!
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '模拟鼠标的左键单击!这两一下也就是双击
i = 0
End If
End Sub
,我调试过了可以运行的啊
Private Const WM_MBUTTONDOWN = &H207
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 Timer1_Timer() '来一个计时四小时来一次
Static i As Integer
i = i + 1
If i = 14400 Then
SetCursorPos 314, 185 '这是里的两个参数是你想要点的坐标改下就可以了啊0`
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '模拟鼠标的左键单击!
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '模拟鼠标的左键单击!这两一下也就是双击
i = 0
End If
End Sub
,我调试过了可以运行的啊
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
试试按键精灵吧,不用人教就会了!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我可以给你做
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询