Try this code:
Code:
var
Form1: TForm1;
wnd1, wnd2: HWND;
WindowName: Integer;
ProcessId: Integer;
ThreadId: Integer;
Buf: PChar;
HandleWindow: Integer;
Write: Cardinal;
WindowTitle: String= 'This_name_of_your_window';
PokeValue: Cardinal= $FFFFFFFF;
NumberOfBytes: Integer = 4;
Code:
function FindWindowByText (var WindowT: String): HWND;
var
Wnd: hWnd;
buff: array[0..127] of Char;
begin
Result := 0;
Wnd := GetWindow(fmMain.Handle, gw_HWndFirst);
while Wnd <> 0 do
begin
if (Wnd <> Application.Handle) and
IsWindowVisible(Wnd) and
(GetWindow(Wnd, gw_Owner) = 0) and
(GetWindowText(Wnd, buff, sizeof(buff)) <> 0) then
begin
GetWindowText(Wnd, buff, sizeof(buff));
if pos(WindowT, StrPas(buff)) > 0 then
begin
Result := Wnd;
WindowT := buff;
Break;
end;
end;
Wnd := GetWindow(Wnd, gw_hWndNext);
end;
end;
Code:
function read_value3 (Address: Pointer; ASize: Cardinal; var AOut: Pointer): Cardinal;
var
WindowH: DWORD;
ThreadId: DWORD;
ProcessId: DWORD;
ProcessH: DWORD;
s: String;
begin
s := 'This_Name_of_your_window_program';
WindowH := Find (s);
ThreadId := GetWindowThreadProcessId (WindowH, ProcessId);
ProcessH := OpenProcess (PROCESS_VM_READ, False, ProcessId);
ReadProcessMemory(ProcessH, Address, AOut, ASize, Result);
CloseHandle (ProcessH);
end;
Code:
function Read_String3 (Address: Pointer; ASize: Cardinal): String;
var
buf: String;
begin
SetLength (buf, ASize);
if read_value3 (Address, ASize, Pointer(buf)) = ASize
then
Result := buf
else
Result := 'Where is window???';
end;
Code:
procedure TForm1.Button1Button(Sender: TObject);
var
res:int64;
s:string;
begin
res:=0;
s:= PAnsiChar(Read_String3(Pointer($000000), 200));
Edti1.Text:='>>' +s;
end;
P.S. I used this code on Delphi 2009.