You could use the toolhelp API
#include <tlhelp32.h>
Process32First()
And loop using
Process32Next()
http://www.codeproject.com/KB/threads/processes.aspx
EDIT delphi
uses tlhelp32;
procedure FillAppList(Applist: Tstrings);
var Snap:THandle;
ProcessE:TProcessEntry32;
begin
Applist.Clear;
Snap:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
ProcessE.dwSize:=SizeOf(ProcessE);
if Process32First(Snap,ProcessE) then
begin
Applist.Add(string(ProcessE.szExeFile));
while Process32Next(Snap,ProcessE) do
.. compare parent id
end
CloseHandle(Snap);
end;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…