Hi James,

A little further investigation revealed that I should have included
TLHELP32.

Anyway, it failed under NT4 saying "The procedure entry point
CreateToolhelp32Snapshot could not be located in the dynamic link library
KERNEL32.DLL", so I guess that answers your question, eh?

Here's a link to some Delphi code that will work on NT, 98/95, and other
platforms too.
http://www.howtodothings.com/showarticle.asp?article=142

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