Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public ChraddCL As Long '人物跳轉地址
Public ChraddSD As Long '商店跳轉地址
Private Const keymf = 192
Dim DRHwnd As Long
Dim DRPid As Long
Dim DRProcessHandle As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Sub Command1_Click()
DRHwnd = FindWindow("Corum Online Project", "Corum Online Project")
GetWindowThreadProcessId DRHwnd, DRPid
DRProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, DRPid)
If DRProcessHandle = 0 Then
MsgBox "外掛開啓失敗", , ""
Else
Command1.Caption = "開啓成功"
Command1.Enabled = False
ReadProcessMemory DRProcessHandle, &H60E3BC, ChraddCL, 4, 0&
ReadProcessMemory DRProcessHandle, &H887980, ChraddSD, 4, 0&
Command2.Enabled = True
Timer1.Enabled = True
Timer2.Enabled = True
Check3.Enabled = True
End If
End Sub
Private Sub Command2_Click()
WriteProcessMemory DRProcessHandle, ChraddSD + 40, &O1, 1, 0& '打開商店
End Sub
Private Sub Timer1_Timer()
If Check3.Value Then
WriteProcessMemory DRProcessHandle, ChraddCL + 68, &H100A, 2, 0& '魔法鎖定
Call Sleep(1)
WriteProcessMemory DRProcessHandle, ChraddCL + 68, &HC0A, 2, 0& '恢復行走
End If
End Sub
Private Sub Timer2_Timer()
If (Not GetAsyncKeyState(9) = 0) And (Not GetAsyncKeyState(vbKeyTab) = 0) Then
WriteProcessMemory DRProcessHandle, ChraddSD + 40, &O1, 1, 0& 'Tab 打開商店
End If
If (Not GetAsyncKeyState(192) = 0) And (Not GetAsyncKeyState(keymf) = 0) Then
If Check3.Value Then
Check3.Value = 0
Else
Check3.Value = 1
End If '~ 開啓魔法
End If
End Sub