⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 本代码只供学习使用
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   1980
   ClientLeft      =   5760
   ClientTop       =   4140
   ClientWidth     =   3315
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   1980
   ScaleWidth      =   3315
   Begin VB.Timer Timer1 
      Left            =   2160
      Top             =   2880
   End
   Begin VB.CheckBox ChkAutoHit 
      Caption         =   "自动攻击(F1)"
      Height          =   225
      Left            =   1770
      TabIndex        =   10
      Top             =   1110
      Width           =   1635
   End
   Begin VB.Timer Timer3 
      Enabled         =   0   'False
      Interval        =   80
      Left            =   3660
      Top             =   1020
   End
   Begin VB.CheckBox ChkTop 
      Caption         =   "置顶"
      Height          =   255
      Left            =   2490
      TabIndex        =   9
      Top             =   330
      Width           =   885
   End
   Begin VB.TextBox TxtMP 
      Alignment       =   2  'Center
      Height          =   270
      Left            =   1770
      TabIndex        =   8
      Text            =   "0"
      Top             =   1680
      Width           =   1515
   End
   Begin VB.TextBox TxtHP 
      Alignment       =   2  'Center
      Height          =   270
      Left            =   1770
      TabIndex        =   7
      Text            =   "0"
      Top             =   1380
      Width           =   1515
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   50
      Left            =   3660
      Top             =   1530
   End
   Begin VB.CheckBox ChkMP 
      Caption         =   "蓝药(F8)   <"
      Height          =   255
      Left            =   120
      TabIndex        =   6
      Top             =   1710
      Width           =   1635
   End
   Begin VB.CheckBox ChkHP 
      Caption         =   "红药(F7)   <"
      Height          =   255
      Left            =   120
      TabIndex        =   5
      Top             =   1410
      Width           =   1635
   End
   Begin VB.CheckBox ChkQL 
      Caption         =   "自动捡物(F6)"
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   1110
      Width           =   1575
   End
   Begin VB.CheckBox Check1 
      Caption         =   "开启辅助(热键 F12)"
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   330
      Width           =   2175
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   495
      Left            =   360
      TabIndex        =   11
      Top             =   2880
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "待完全进入游戏后再勾选开启辅助"
      Height          =   195
      Left            =   120
      TabIndex        =   4
      Top             =   90
      Width           =   2895
   End
   Begin VB.Label LbMP 
      Caption         =   "MP: 0 / 0"
      Height          =   195
      Left            =   120
      TabIndex        =   1
      Top             =   870
      Width           =   3015
   End
   Begin VB.Label LbHP 
      Caption         =   "HP: 0 / 0"
      Height          =   195
      Left            =   120
      TabIndex        =   0
      Top             =   630
      Width           =   3015
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ecxi As Long, eax As Long


Dim hwd As Long
Dim pid As Long
Dim hProcess As Long





Private Sub Check1_Click()
    If Check1.Value = 1 Then
        GameFormHwnd = FindWindow("ElementClient Window", "Element Client")
        If GameFormHwnd = 0 Then
            Started = False
            Check1.Value = 0
            Timer2.Enabled = False
            Timer3.Enabled = False
            MsgBox "请确认是否已打开游戏!"
        Else
            hptime = 0
            mptime = 0
            hpused = 0
            mpused = 0
            Started = True
            GetWindowThreadProcessId GameFormHwnd, hProcId
            Timer2.Enabled = True
            Timer3.Enabled = True
        End If
    Else
        Started = False
        Timer2.Enabled = False
        Timer3.Enabled = False
    End If
End Sub

Private Sub ChkTop_Click()
    Dim b As Boolean
    b = ChkTop.Value
    SetFormOnTop Form1, b
End Sub

Private Sub Form_Load()
    App.TaskVisible = False
    Readini
    m_hDllKbdHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
End Sub


Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii < Asc(0) Or KeyAscii > Asc(9) Then
        KeyAscii = 0
        'MsgBox "请输入数字"
    End If
End Sub


Private Sub Form_Unload(Cancel As Integer)
    Writeini
    If m_hDllKbdHook <> 0 Then
        Call UnhookWindowsHookEx(m_hDllKbdHook)
    End If
End Sub



Private Sub TxtHP_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    TxtHP.SelStart = 0
    TxtHP.SelLength = Len(TxtHP.Text)
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
    If KeyAscii < Asc(0) Or KeyAscii > Asc(9) Then
        KeyAscii = 0
        'MsgBox "请输入数字"
    End If
End Sub

Private Sub TxtMP_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    TxtMP.SelStart = 0
    TxtMP.SelLength = Len(TxtMP.Text)
End Sub

Private Sub Timer2_Timer()
    ProcessID = OpenProcess(PROCESS_ALL_ACCESS Or PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, hProcId)
    
    ReadProcessMemory ProcessID, ByVal &H9398EC, ecxi, 4, 0
    ReadProcessMemory ProcessID, ByVal ecxi + &H20, eax, 4, 0
    ReadProcessMemory ProcessID, ByVal eax + &H454, HP, 4, 0
    ReadProcessMemory ProcessID, ByVal eax + &H458, MP, 4, 0
    ReadProcessMemory ProcessID, ByVal eax + &H484, MAXHP, 4, 0
    ReadProcessMemory ProcessID, ByVal eax + &H488, MAXMP, 4, 0
    LbHP.Caption = "HP: " & CStr(HP) & " / " & CStr(MAXHP)
    LbMP.Caption = "MP: " & CStr(MP) & " / " & CStr(MAXMP)
    
    CloseHandle ProcessID
End Sub

Private Sub Timer3_Timer()
    Toph = GetForegroundWindow
    If Toph <> GameFormHwnd Then Exit Sub
    If ChkHP.Value = 1 And HP < CLng(TxtHP.Text) Then
        hptime = hptime + 1
        If hpused = 0 Then
            SendAKey VK_F7
            hpused = 1
        End If
        If hptime > 6 Then
            hptime = 0
            hpused = 0
        End If
    End If
    If ChkMP.Value = 1 And MP < CLng(TxtMP.Text) Then
        
        mptime = mptime + 1
        If mpused = 0 Then
            SendAKey VK_F8
            mpused = 1
        End If
        
        If mptime > 6 Then
            mptime = 0
            mpused = 0
        End If
    End If
    If ChkAutoHit.Value = 1 Then SendAKey VK_F1
    If ChkQL.Value = 1 Then SendAKey VK_F6
End Sub


Private Sub Readini()
    Dim sp As String
    sp = App.Path & "/settings.ini"
    Dim mh As String, mm As String
    Dim ml As String, mt As String
    mh = Space$(100): mm = Space$(100)
    ml = Space$(100): mt = Space$(100)
    GetPrivateProfileString& "Info", "HP", "100", mh, 100, sp
    GetPrivateProfileString& "Info", "MP", "100", mm, 100, sp
    TxtHP.Text = Trim(mh)
    TxtMP.Text = Trim(mm)
    GetPrivateProfileString& "Form", "Left", "-1", ml, 100, sp
    GetPrivateProfileString& "Form", "Top", "-1", mt, 100, sp
    If CLng(Trim(ml)) > 0 Then Form1.Left = CLng(Trim(ml))
    If CLng(Trim(mt)) > 0 Then Form1.Top = CLng(Trim(mt))
End Sub


Private Sub Writeini()
    Dim sp As String
    sp = App.Path & "/settings.ini"
    WritePrivateProfileString& "Info", "HP", TxtHP.Text, sp
    WritePrivateProfileString& "Info", "MP", TxtMP.Text, sp
    If Form1.WindowState = 0 Then
        WritePrivateProfileString& "Form", "Left", Form1.Left, sp
        WritePrivateProfileString& "Form", "Top", Form1.Top, sp
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -