显示数据的6步骤

//显示数据 
//1 查找窗口
FindWindow(1,2):HWND; {查找窗口}
1->lpclassName {窗口的类名}
2->lpWindowName:Pchar {窗口的标题}
example:
myHwnd:=FindWindow(nil,'Step 8'); {HWND失败返回 0}

//2 获取窗口线程ID
GetWindowThreadProcessId(1,2):Dword; {获取窗口线程ID}
1->hwnd:HWND {指定窗口句柄}
2->lpdwProcessId:Pointer {返回进程 ID 的指针}
example:
  GetWindowThreadProcessId(MyHwnd,@myPid);

//3 打开进程
OpenProcess(1,2,3):Thandle; {打开进程} {成功会返回进程句柄; 失败返回 0}
1->dwDesireAccess:DWORD {访问选项}
2->bInheritHandle:BOOL {能否继承; True 表示能用 CreateProcess 继承句柄创建新进程}
3->dwProcessId:Dword {指定进程 ID}
example:
  myProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,myPid);

//4 读取进程内存
ReadProcessMemory(1,2,3,4,5); {读取进程内存}
1->Handle:Hprocess {目标进程句柄}
2->LPCVOID lpBaseAddress {读取数据的起始地址}
3->LPvoid lpBuffer {存放数据的缓存区地址}
4->DWord nSize {要读取的字节数}
5->LPDWORD lpNumberOfBytesRead {实际读取数存放地址} {delphi xe: readByte:SIZE_T;}
example:
  ReadProcessMemory(myProcess,Pointer(BaseAddress),@MyPointer,4,ReadByte);

//5 关闭句柄
CloseHandle(1):BOOL; {关闭句柄}
1->hObject :HANDLE {代表一个已打开对象handle}
example:
  CloseHandle(myProcess);

//06 显示并输出结果




你可能感兴趣的:(数据)