I use the following function to get a list of processes. It works on 2k/XP.
I have a funny feeling that it doesn't work on NT or 98.
I don't have an NT box to try it on, could someone please either confirm
that it works/doesn't under NT or post an NT equivalent?
TIA
James
function DoesProcessExist( ProcessName : String ) : Boolean;
var
handler: THandle;
data: TProcessEntry32;
function GetName: string;
var i:byte;
begin
Result := '';
i := 0;
while data.szExeFile[i] <> '' do
begin
Result := Result + Uppercase(data.szExeFile[i]);
Inc(i);
end;
end; { function }
begin
Result := False;
handler := CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
if Process32First(handler, data) then
begin
if GetName = ProcessName then
begin
Result := True;
Exit;
end;
while Process32Next(handler, data) do
begin
if GetName = ProcessName then
begin
Result := True;
Exit;
end; { if }
end; { while }
end; { if }
end;
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi