uses TLHelp32<br> <br>var lppe: TProcessEntry32; <br>found : boolean; <br>Hand : THandle; <br>begin <br>Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0); <br>found := Process32First(Hand,lppe); <br>while found do <br>begin <br>ListBox.Items.Add(StrPas(lppe.szExeFile));//列出所有进程。 <br>found := Process32Next(Hand,lppe); <br>end; <br>end; <br>---------------------------<br>uses ... TLHelp32, ... <br>type <br>TForm1 = class(TForm) <br>... <br>end; <br><br>var <br>Form1: TForm1; <br>l : Tlist; ////返回的东东在"L"这个TList中。 <br><br>type <br>TProcessInfo = Record <br>ExeFile : String; <br>ProcessID : DWORD; <br>end; <br>pProcessInfo = ^TProcessInfo; <br><br>implementation <br><br>{$R *.DFM} <br><br>procedure TForm1.FormCreate(Sender: TObject); <br>var p : pProcessInfo; <br>i : integer; <br>ContinueLoop:BOOL; <br>var <br>FSnapshotHandle:THandle; <br>FProcessEntry32:TProcessEntry32; <br>begin <br>l := TList.Create; <br>l.Clear; <br>FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); <br>FProcessEntry32.dwSize:=Sizeof(FProcessEntry32); <br>ContinueLoop:=Process32First(FSnapshotHandle,FProcessEntry32); <br>while integer(ContinueLoop)<>0 do <br>begin <br>New(p); <br>p.ExeFile := FProcessEntry32.szExeFile; <br>p.ProcessID := FProcessEntry32.th32ProcessID; <br>l.Add(p); <br>ContinueLoop:=Process32Next(FSnapshotHandle,FProcessEntry32); <br>end; <br>end; <br><br>procedure TForm1.FormDestroy(Sender: TObject); <br>var p : pProcessInfo; <br>i : integer; <br>begin <br>With l do <br>for i := Count - 1 DownTo 0 do <br>begin p := items; Dispose(p); Delete(i); end; <br>end; <br><br>... <br>end. <br>--------------------------------<br>再用pos()函数看看你要的程序名在不在进程列表里面就可以了<br>