none
ReadProcessMemory問題 RRS feed

  • 問題

  • Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
      Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Integer, ByRef lpdwProcessId As Integer) As Boolean
      Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
    Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, _
      ByVal lpBaseAddress As Integer, _
      ByVal lpBuffer() As Byte, _
      ByVal dwSize As Integer, _
      ByRef lpNumberOfBytesRead As Integer
      ) As Boolean
    
     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim hwnd As Integer
        Dim pid As Integer
        Dim xa As Boolean
        Dim pHandle As Integer
        Const timer As Integer = &H76B14E4F
        Const PROCESS_ALL_ACCESS As Integer = &H5010300
        Dim x1(20) As Byte
    
        hwnd = FindWindow(vbNullString, "踩地雷")
        xa = GetWindowThreadProcessId(hwnd, pid)
        pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
        xa = ReadProcessMemory(pHandle, timer, x1, x1.Length, 0)
      End Sub
    

    小弟寫一個讀採地雷的dll中的timeGetTime資料可是在最後ReadProcessMemory都沒回傳東西回來貼上小弟的程式麻煩大大跟我說一下我錯在那

     

    2011年3月11日 下午 12:04

解答

所有回覆