Thanks heaps.
That worked. Only mod is:
GetModuleFileNameEx(ProcHandle, 0, szModuleName,MAX_PATH);
Which returns the original EXE, not the Module name.

Ta,
Dave.
-----Original Message-----
From: Nello Sestini [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 12, 2001 1:33 PM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Process ID's


try

..\source\rtl\win\psapi.pas

(thank heavens for grep)

-ns


----- Original Message -----
From: "David O'Brien" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Thursday, July 12, 2001 8:22 AM
Subject: RE: [DUG]: Process ID's


> Sorry,
> Can't find GetModuleFileNameEx not GetWindowLongEx.
>
> Dave.
>
> -----Original Message-----
> From: Nello Sestini [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 12, 2001 1:10 PM
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Process ID's
>
>
> Using your ProcHandle and hWnd, continue on with:
>
> GetModuleFileNameEx(ProcHandle,
>     GetWindowLong(hWnd,GWL_HINSTANCE),szModuleName,MAX_PATH);
>
>
> I think this gives you the filename you want in szModuleName.
>
> You might need a typecast on the GetWindowLong result - I
kludged
> this from C++
>
> -ns
>
> ----- Original Message -----
> From: "David O'Brien" <[EMAIL PROTECTED]>
> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> Sent: Thursday, July 12, 2001 7:50 AM
> Subject: [DUG]: Process ID's
>
>
> > I have managed to get the ProcessID from a Windows Handle:
> >
> > GetWindowThreadProcessID(hWnd, @ProcID) ;
> >
> > And created a handle to the process:
> >
> > ProcHandle := OpenProcess(Process_All_Access, False, ProcID)
;
> >
> > But what I really want, is to find all the currently running
> applications on
> > a machine that have a window, and retrieve the original "File
> Path" of the
> > application.
> >
> > i.e. "c:\program files\borland\delphi5\bin\delphi32.exe"
> >
> > I'm afraid I thought this was going to be easy, but with my
> trusty Tomes
> > "Win32 Core API" by my side, I am still stumped.
> >
> > Is this possible?
> >
> > Dave.
>
> ---------------------------------------------------------------
> ------------
> >     New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> > Web Archive at:
> http://www.mail-archive.com/delphi%40delphi.org.nz/
>
>
>
> ---------------------------------------------------------------
------------
>     New Zealand Delphi Users group - Delphi List -
[EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at:
http://www.mail-archive.com/delphi%40delphi.org.nz/
> ---------------------------------------------------------------
------------
>     New Zealand Delphi Users group - Delphi List -
[EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at:
http://www.mail-archive.com/delphi%40delphi.org.nz/

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to