//列出当前的进程中的文件路径<br>1.CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br>2.ProcessFirst<br>3.ProcessNext;<br>试一下吧,我前几天刚刚搞定,派上用途了。<br><br>(* Windows NT: Requires version 5.0 or later.<br> Windows: Requires Windows 95 or later.<br> Windows CE: Unsupported.<br> Header: Declared in tlhelp32.h.<br> Import Library: Use kernel32.lib.*)<br><br>uses tlhelp32;<br>Function ListRuningExeName(ExeName:TStrings):Integer;<br>Var<br> iHandle:LongInt;<br> lppe:tagProcessentry32;<br> i:integer;<br>begin<br> i:=0;<br> iHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br> try<br> try<br> if iHandle=-1 then Raise Exception.Create('调用失败!');<br> Process32First(iHandle,lppe);<br> While GetLastError<>ERROR_NO_MORE_FILES do<br> begin<br> inc(i);<br> ExeName.Add(lppe.szExeFile);<br> Process32Next(iHandle,lppe);<br> end;<br> except<br> On E:Exception do begin<br> Application.HandleException(E);<br> i:=-1;<br> end;<br><br> end;<br> finally<br> CloseHandle(iHandle);<br> Result:=i;<br> end;<br>end;<br>