放5天假的期間.. 嘗試做了好多VB的東西
可是我最想做的讀記憶體還是學不會
只弄得出偵測遊戲有沒有運行..
我目前做到這樣... (網路上找的)
這個是讀取踩地雷這個程式Address:1005194的Value
將它顯示在Label4上面
由於搞不董這程式碼是在做什麼..
只是照著複製過來
所以運行後Label4一直顯示不正確的數字
如果弄出正確的程式碼
以後我就做得出東西了..
有高手能幫我看一下嗎?
謝謝
Private Sub Timer1_Timer()
Dim hwnd As Long
hwnd = FindWindow(vbNullString, "踩地雷")
If hwnd = 0 Then
Label2.Caption = "遊戲未運行"
Else
Label2.Caption = "遊戲已運行"
End If
spa = &H1005194
Label4.Caption = spa
End Sub
Private Function ncnr(lpADDress As Long) As Integer
Dim hwnd As Long
Dim pid As Long
Dim pHandle As Long
Dim spa As Long
hwnd = FindWindow(vbNullString, "踩地雷")
GetWindowThreadProcessId hwnd, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
ReadProcessMemory pHandle, lpADDress, ByVal VarPtr(ncnr), 4, 0&
CloseHandle hProcess
End Function
以下是宣告區
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 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 Declare Function GetCurrentProcess Lib "kernel32" () As Long
- Nov 11 Tue 2014 19:47
求學讀記憶體
close
全站熱搜
留言列表
發表留言