getwindowtext not retrieving text

Posted by omair iqbal on Stack Overflow See other posts from Stack Overflow or by omair iqbal
Published on 2009-09-16T15:57:00Z Indexed on 2010/03/20 2:41 UTC
Read the original article Hit count: 501

Filed under:
|
|

I tried the following code but it does not retrieve text from foreground window!

procedure TForm1.Button1Click(Sender: TObject);
 var
  title : pansichar;
  s : string;
begin
    GetWindowText(GetForegroundWindow(), title,GetWindowTextLength(GetForegroundWindow()) + 1);
    s := title;
    showmessage(s);
end;

© Stack Overflow or respective owner

Related posts about delphi

Related posts about api