DingDang下面的代码或许对你有所帮助<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls;<br><br>type<br> EnumThreadWndProc=function(hw:HWND;lP:LPARAM):boolean;<br><br>type<br> TForm1 = class(TForm)<br> ListBox1: TListBox;<br> Button1: TButton;<br> Button2: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure Button2Click(Sender: TObject);<br> procedure ListBox1DblClick(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br> function Enum(hw:HWND;lP:LPARAM):boolean;stdcall;<br><br>var<br> Form1: TForm1;<br> st:TStartUpInfo;<br> pp:array[1..3] of TProcessInformation;<br> ppp:Thandle;<br> pppp:TProcessInformation;<br><br>implementation<br><br>{$R *.DFM}<br><br>function Enum(hw:HWND;lP:LPARAM):boolean;<br>var<br> Buffer:Array[0..255] of Char;<br>begin<br> GetWindowText(hw,buffer,256);<br> TListBox(lp).items.addobject(buffer,Tobject(hw));<br> Result:=true;<br>end;<br><br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> proc:EnumThreadWndProc;<br> i:integer;<br>begin<br> proc:=@Enum;<br>for i:=1 to 3 do<br> EnumThreadWindows(pp.dwThreadId,@proc,lparam(listbox1));<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>FillChar(st,sizeof(st),#0);<br>with st do<br>begin<br> cb:=sizeof(st);<br> dwFlags:=StartF_UsesTDHandles or STARTF_USESHOWWINDOW;<br> lptitle:=nil;<br> wShowWindow:=SW_HIDE;<br>end;<br>CreateProcess(PChar('c:/program files/microsoft office/office/winword.exe'),<br> nil,nil,nil,true,DETACHED_PROCESS,nil,nil,st,pp[1]);<br>CreateProcess(PChar('c:/program files/microsoft office/office/Excel.exe'),<br> nil,nil,nil,true,DETACHED_PROCESS,nil,nil,st,pp[2]);<br>CreateProcess(PChar('c:/program files/microsoft office/office/MSACCESS.exe'),<br> nil,nil,nil,true,DETACHED_PROCESS,nil,nil,st,pp[3]);<br>// ppp:=OpenProcess(PROCESS_ALL_ACCESS, FALSE,pp.dwProcessId );<br>// TerminateProcess(ppp,0);<br>end;<br><br>procedure TForm1.ListBox1DblClick(Sender: TObject);<br>begin<br> ppp:=Thandle(Listbox1.Items.Objects[Listbox1.ItemIndex]);<br> showwindow(ppp,sw_show);<br>end;<br><br>end.