function EnumWindowProc( hWnd:HWND; lParam: LPARAM ):bool; stdcall;
var
pid: DWORD;
buf: string;
begin
if (not IsWindow(hwnd)) or (not IsWindowVisible(hwnd)) then // || GetParent(hwnd)!=0)
begin
result := true;
exit;
end;
GetWindowThreadProcessId(hwnd, @pid);
if (pid = 0) then
begin
result := true;
exit;
end;
SetLength( buf, 256 );
GetWindowText(hwnd, pchar(buf), 256);
if (buf = '') then
begin
result := true;
exit;
end;
form1.Memo1.Lines.Add(buf)
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
EnumDesktopWindows(HDESK(0),@EnumWindowProc, 0);
end;