Using this way I can get the correct value, but I would like an example of how to read the memory of my own process without using ReadProcessMemory.
var
Modulo : HMODULE;
Value1, Value2, Read : Cardinal;
GetWindowTextAAPI: function (hWnd: HWND; lpString: PChar; nMaxCount: integer):integer; stdcall;
begin
Modulo := GetModuleHandle('user32.dll');
if (Modulo <> 0) then
begin
@GetWindowTextAAPI := GetProcAddress(Modulo, 'GetWindowTextA');
if (@GetWindowTextAAPI <> nil) then
begin
ReadProcessMemory(GetCurrentProcess, Pointer(@GetWindowTextAAPI), Addr(Value1), 4, Read);
ReadProcessMemory(GetCurrentProcess, Pointer(DWORD(@GetWindowTextAAPI)+4), Addr(Value2), 4, Read);
ShowMessage(
IntToStr(Value1)
+ ' ' +
IntToStr(Value2)
);
end;
end;
end;
How to Use the function CopyMemory correctly?