如何使用OpenProcess(PROCESS_ALL_ACCESS, False, pid)打开一个进程

来源:百度知道 编辑:UC知道 时间:2024/05/16 02:12:55
RT.

1.首先要知道进程ID号(任务管理器,可以看到pid进程id,
这里是查找窗体名,再获得进程id)
2.打开进程
3.操作内存
4.关闭进程

'----添加个新工程----
'复制代码

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 CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32.dll" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Declare Funct