
Finding an application's executable name and path
According to the winapi c group, GetModuleFileName is not supported under
32-bit windows because it invades another application's memory area.
--
Randy Birch, MVP Visual Basic
Moderator, Fidonet Visual Basic Programmer's Conference
VBnet, The Visual Basic Developers Resource Centre
http://home.sprynet.com/sprynet/rasanen/
: I've been trying to get an application's exe name and path.
:
: I am currently trying to do this using GetModuleFileName. Here's the
: declaration:
:
: Declare Function GetModuleFileName& Lib "kernel32" Alias
: "GetModulefileNameA" (ByVal hModule As Long, ByVal lpFileName As String,
: ByVal nSize As Long)
:
: I have to pass the hModule in order to get the exe name. I've tried
: getting the module handle using GetModuleHandle, but it's just not
working
: because that API needs the module name (lpModuleName As String). Well.
I
: have no idea how to get the module name...the only thing I know about the
: application are it's hWnd, ProcessID, and Caption.
:
: Any ideas where I am doing something wrong? Or do you have a better way?
:
: -Sincerely,
:
: Patrick Milam
:
:
: