逆向大漠插件/用VB6.0实现后台鼠标移动和后台鼠标左键点击

自动化设计软件,在一款做门的设计软件CypCut6.3 上实现了自动化勾选了 复选框。一切都是基于后台的。

逆向大漠插件/用VB6.0实现后台鼠标移动和后台鼠标左键点击_第1张图片

Private Const GW_CHILD = 5
Private Const GW_HWNDFIRST = 0
Private Const GW_HWNDNEXT = 2
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long  '发送消息,用来关闭指定程bai序


 Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long

 Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long

  Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
  
  Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  
    
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const WM_GETTEXT = &HD&
    Private Const WM_GETTEXTLENGTH = &HE&
    
    Public Const WM_SETTEXT = &HC& '设置窗体的Caption
    
    
    Private Const WM_LBUTTONDOWN = &H201
    Private Const WM_LBUTTONUP = &H202
    Private Const VK_CONTROL = &H11
    Private Const VK_SHIFT = &H10
    Private Const VK_RETURN = &HD
    Private Const VK_1 = &H31
    Private Const WM_KEYDOWN = &H100
    Private Const WM_KEYUP = &H101
    Private Const WM_MOUSEMOVE = &H200
    Private Const WM_ACTIVATE = 6
    Private Const WM_SETFOCUS = 7
    Private Const WM_KILLFOCUS = 8
    
    Private Const WM_NCHITTEST = &H84&
    
    Private Const MK_LBUTTON = 1 '鼠标左键KEY
    Private Const MK_RBUTTON = 2 ' 鼠标右键KEY

  

'模拟鼠标后台点击
  Private Function SendClick(hwnd As Long, mX As Long, mY As Long)

    '发送点击消息

    Dim I As Long

         PostMessage hwnd, WM_MOUSEMOVE, 0, (mX And &HFFFF) + (mY And &HFFFF) * &H10000 '模拟鼠标消息移动

        PostMessage hwnd, WM_LBUTTONDOWN, MK_LBUTTON, (mX And &HFFFF) + (mY And &HFFFF) * &H10000 '模拟鼠标左键点击

        PostMessage hwnd, WM_LBUTTONUP, 0, (mX And &HFFFF) + (mY And &HFFFF) * &H10000 '模拟鼠标右键点击

End Function

VB技术研发群 214016721

你可能感兴趣的:(计算机外设)