BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Application needs to find it's directory

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
Don Payette
Guest





PostPosted: Thu Jul 24, 2003 6:29 pm    Post subject: Re: Application needs to find it's directory Reply with 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:

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





PostPosted: Thu Jul 24, 2003 6:46 pm    Post subject: Re: Application needs to find it's directory Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.