 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Don Payette Guest
|
Posted: Thu Jul 24, 2003 6:29 pm Post subject: Re: Application needs to find it's directory |
|
|
Better for readability would be ExtractFilePath (Application.ExeName).
For DLL's this won't work. The DLL runs in the space of the application
and ParamStr (0) will be the name of the executable that linked to the DLL.
Good luck finding the full path of the DLL. I just did a quick browse through
MSDN and it looks like the memory structures only have the filename part,
not the full path (search on "portable executable" to find the format
of the internal structures used by Windows for such things).
"Stephen R. Phillips" <cyberman (AT) socket (DOT) net> wrote:
| Quote: | "Steve Trefethen (Borland)" <strefethen (AT) non (DOT) spam.junk.borland.com> wrote
in news:3f1ed873$1 (AT) newsgroups (DOT) borland.com:
Application needs to find it's directory
ExtractFilePath(ParamStr(0))
ParamStr(0) returned the complete path+filename of the executible.
Hmmm.. thanks and that was so simple as well. I had forgotten such a simple
thing (sigh).
Worked just fine, well now I can do this for both win DLL's and EXE :)
Stephen
|
Don Payette
Unisys Corporation
|
|
| Back to top |
|
 |
Yahia El-Qasem Guest
|
Posted: Thu Jul 24, 2003 6:46 pm Post subject: Re: Application needs to find it's directory |
|
|
Just use the Win32 API :
GetModuleFileName
It gives you with an EXE and with a DLL always the directory of the running
app...
HTH
Yahia
"Don Payette" <Nobody (AT) nowhere (DOT) com> schrieb im Newsbeitrag
news:a270ivoj0k104522iac5bd9l2a2oikvgo7 (AT) 4ax (DOT) com...
| Quote: | Better for readability would be ExtractFilePath (Application.ExeName).
For DLL's this won't work. The DLL runs in the space of the application
and ParamStr (0) will be the name of the executable that linked to the
DLL.
Good luck finding the full path of the DLL. I just did a quick browse
through
MSDN and it looks like the memory structures only have the filename part,
not the full path (search on "portable executable" to find the format
of the internal structures used by Windows for such things).
"Stephen R. Phillips" <cyberman (AT) socket (DOT) net> wrote:
"Steve Trefethen (Borland)"
wrote
in news:3f1ed873$1 (AT) newsgroups (DOT) borland.com:
Application needs to find it's directory
ExtractFilePath(ParamStr(0))
ParamStr(0) returned the complete path+filename of the executible.
Hmmm.. thanks and that was so simple as well. I had forgotten such a
simple
thing (sigh).
Worked just fine, well now I can do this for both win DLL's and EXE :)
Stephen
Don Payette
Unisys Corporation
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|