unit EnumWindows;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> ListBox1: TListBox;<br> Button1: TButton;<br> procedure EnumWindowProc(AWnd:HWND;AlParam:LPARAM);<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.EnumWindowProc(AWnd: HWND; AlParam: LPARAM);<br>var<br> sStr:String;<br>begin<br> SetLength(sStr,255);<br> GetWindowText(AWnd,@sStr[1],255);<br> ListBox1.Items.Add(Format('%d %s',[AWnd,sStr]));<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> EnumWindows(EnumWindowProc,0);<br>end;<br><br>end.<br>