procedure TForm1.Button1Click(Sender: TObject);
var
 hCurrentWindow:HWND;
 szText:array [0..254] of char;
begin
 hCurrentWindow := GetWindow (Handle ,GW_HWNDFIRST);
  if GetWindowText (hCurrentWindow ,@szText,255) >0 then
  ListBox1.Items.Add (strpas(@szText));
 while hCurrentWindow <> 0 do
 begin
 if GetWindowText (hCurrentWindow ,@szText,255) >0 then
  ListBox1.Items.Add (strpas(@szText));
 hCurrentWindow := GetWindow (hCurrentWindow ,GW_HWNDNEXT);
 end;
 end;