用如下代码就可以啦:方法也是用enumprocess<br><br>unit Unit1;<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> Button1: TButton;<br> Memo1: TMemo;<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>function EnumWindowsProc(AHWnd: HWnd;<br> LPARAM: lParam): boolean; stdcall;<br>var<br> WndCaption: array[0..254] of char;<br> WndClassName: array[0..254] of char;<br>begin<br> GetWindowText(AHWnd, @WndCaption, 254);<br> GetClassName(AHWnd, @WndClassName, 254);<br> with Form1.Memo1.Lines do<br> begin<br> Add(StrPas(WndCaption));<br> Add(StrPas(WndClassName));<br> Add('-------');<br> end;<br><br> Result := True;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> Memo1.Lines.Clear;<br> EnumWindows(@EnumWindowsProc, 0);<br>end;<br><br>end.<br><br>