VB读其他进程的内存的问题

来源:百度知道 编辑:UC知道 时间:2024/06/14 19:41:15
模块部分:
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Public Declare Function ReadProcessMemory Lib "kernel32&q

Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
Dim sBuffer As String * 255, sText As String
Call GetWindowText(hwnd, sBuffer, 256)
sText = sBuffer
EnumWindowsProc = True ‘函数这里举退出了吧。

phandle = OpenProcess(PROCESS_VM_READ, False, lppid)
’自己检查一下获取的phandle 成不成功吧。