Hi James,

I tried this with BCB4 but it didn't know what TProcessEntry32 or
CreateToolhelp32Snapshot was.
I even looked in BCB6 help and the August 2002 (I think) Platform SDK from
Microsoft, but didn't see any reference to this stuff at all.

Regards,

Bevan

---
Bevan Edwards    mailto:[EMAIL PROTECTED]
Achieve Software Limited  http://www.achieve.co.nz
Phone: (64-9) 444-4210   ICQ: 732011
Fax: (64-9) 444-4201
Mobile: (64-21) 979-603


----- Original Message ----- 
From: "James Sugrue" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 27, 2004 10:58 AM
Subject: [DUG] Getting Process List on Win98/NT/2000


> 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
>


_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to