Siema,
jeszcze raz ja. Trudzę się od jakiegoś czasu z czymś takim jak pobieranie zawartości okna, a mianowicie chodzi mi o coś takiego jak robią w KeyGenerator'ach, czyli po naciśnięciu "generuj kod" poza oczywiście generacją, wpisują wartości do odpowiednich pól w uruchomionej grze.

Próbuje zrobić coś takiego, ale z pobieraniem zawartości okna a nie wpisywaniem do niego. Niestety udaje mi się pobrać tylko nazwę okna np: Calypso. Wykonuje to przy pomocy GetWindowText, EnumWindows, EnumWindowsProc itp.

Nie wiem jaką funkcję mam podać lub co zmienić w uchwycie okna. Poniżej zamieszczam kod:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, wininet, PsAPI, TlHelp32;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
   arr:array of HWND;
   Int: integer;
    { Public declarations }
  end;

var
  Form1: TForm1;
const
  RsSystemIdleProcess = 'System Idle Process';
  RsSystemProcess = 'System Process';

implementation

{$R *.dfm}

function ProcessFileName(PID: DWORD; FullPath : boolean): string;
var
Handle: THandle;
begin
Result := '';
Handle := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, PID);
if Handle <> 0 then
try
SetLength(Result, MAX_PATH);
if FullPath then
begin
if GetModuleFileNameEx(Handle, 0, PChar(Result), MAX_PATH) > 0 then
SetLength(Result, StrLen(PChar(Result)))
else
Result := '';
end
else
begin
if GetModuleBaseNameA(Handle, 0, PChar(Result), MAX_PATH) > 0 then
SetLength(Result, StrLen(PChar(Result)))
else
Result := '';
end;
finally
CloseHandle(Handle);
end;
end;

function EnumWindowsProc(wHandle: HWND): Boolean; StdCall; Export;
var
PID : DWORD;
title, className: array[0..128] of Char;
sTitle, sClass, sLine, ExeName : string;
begin
Result := True;
GetWindowText(wHandle, title, GetWindowTextLength(wHandle)+1);
GetClassName(wHandle, className, GetWindowTextLength(wHandle)+1);
sTitle := title;
sClass := className;

GetWindowThreadProcessId(WHandle, @PID);
ExeName := ProcessFileName(PID, False);

if IsWindowVisible(wHandle)
then
begin
 SetLength(Form1.arr,Form1.int+1);
 Form1.arr[Form1.int]:=FindWindow(className,0);
sLine := sTitle;
Form1.memo1.Lines.add('['+inttostr(Form1.int)+']'+sLine + ' || ' + ExeName);
 inc(Form1.int);
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
int:=0;
EnumWindows(@EnumWindowsProc, 0);
end;

procedure TForm1.Button2Click(Sender: TObject);
var title: array[0..128] of Char;
    sTitle: string;
    i,j:integer;
begin
 i:=6;
 j:=GetWindowTextLength(arr[i])+1;
GetWindowText(arr[i], title, j);
sTitle := title;
ShowMessage(sTitle+' : '+inttostr(j));
end;

end.

Bardzo proszę o pomoc. Dla ułatwienia dodam że chce pobierać zawartość pól z maila, który przychodzi do programu Calypso.