|
楼主 |
发表于 2009-10-23 21:47:25
|
显示全部楼层
发源码上来看看
繁华落尽 发表于 2009-10-23 18:50
Option Explicit
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 Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId 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
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const PROCESS_ALL_ACCESS As Long = &H1F0FFF
Public hProces1 As Long
Dim hwd As Long
Dim pid As Long
Dim hProcess As Long
Private Sub Form_Load()
hwd = FindWindow("***", "***")
If hwd = 0 Then
MsgBox "未启动游戏", vbOKOnly, "提示"
Unload Form1
End If
GetWindowThreadProcessId hwd, pid
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)
If hProcess = 0 Then
MsgBox "不能打开进程", vbOKOnly, "提示"
Unload Form1
End If
CloseHandle hProcess
End Sub
Private Sub Timer1_Timer()
Dim h As Long
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If hProcess Then
ReadProcessMemory hProcess, ByVal &H985614, h, 4, 0&
ReadProcessMemory hProcess, ByVal h + &H24, h, 4, 0&
ReadProcessMemory hProcess, ByVal h + &H260, h, 4, 0&
CloseHandle hProcess
End If
Label1.Caption = h
End Sub
具体功能是,提取某个地址的值,在VB中显示,我把具体游戏隐藏了, |
|