下面这些是一网络游戏外挂代码,由于小第刚接触VB,所以想请教高手,如何制作成品。另外对其中
MsgBox "Window not found!"这句不明白,望高手指点迷津。在这先谢谢了
Option Explicit
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Sub Command1_Click()
Dim hwnd As Long
Dim ProcessID As Long
Dim ProcessHandle As Long
hwnd = FindWindow(vbNullString, "QQTang 0.10 Beta6 Build12") '获取窗口句柄
If (hwnd = 0) Then
MsgBox "Window not found!"
Exit Sub
End If
GetWindowThreadProcessId hwnd, ProcessID '获取进程ID
ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID) '打开进程
If (ProcessHandle = 0) Then
MsgBox "Couldn't get a process handle!"
Exit Sub
End If
'下面为写内存主要代码
WriteProcessMemory ProcessHandle, &H40000, ByVal ("1"), 1, ByVal 0& '写内存
CloseHandle ProcessHandle '关闭进程
End Sub