close



放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

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 UM程式研究日誌 的頭像
    UM程式研究日誌

    UM程式研究日誌

    UM程式研究日誌 發表在 痞客邦 留言(0) 人氣()