看看这个行不行,proname为任务管理器里进程的名字<br>function TActiveFormX.HasOpened(proname: String): Boolean;<br>var p : pProcessInfo;<br> ContinueLoop:BOOL;<br>var<br> FSnapshotHandle:THandle;<br> FProcessEntry32:TProcessEntry32;<br> Lst: TStringList;<br>begin<br> Lst := TStringList.Create;<br> FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br> FProcessEntry32.dwSize:=Sizeof(FProcessEntry32);<br> ContinueLoop:=Process32First(FSnapshotHandle,FProcessEntry32);<br> while integer(ContinueLoop)&lt;&gt;0 do<br> begin<br> New(p);<br> p.ExeFile := FProcessEntry32.szExeFile;<br> p.ProcessID := FProcessEntry32.th32ProcessID;<br> Lst.Add(p.ExeFile);<br> ContinueLoop:=Process32Next(FSnapshotHandle,FProcessEntry32);<br> end;<br> Result := Lst.IndexOf(proname) &gt;= 0;<br> Lst.Free;<br>end;