function Proc(Wnd: HWnd; Memo: TMemo): boolean; stdcall;
var
Buffer: array[0..max_path - 1] of char;
begin
GetWindowText(Wnd, Buffer, 100);
if StrLen(Buffer) <> 0 then
Memo.Lines.add(StrPas(Buffer));
Result := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.clear;
Memo1.scrollbars := ssBoth;
Memo1.Lines.beginupdate;
EnumWindows(@Proc, Integer(Memo1));
Memo1.Lines.endupdate;
end;