🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6773

Re: Retrieving the Start from directory

#6773
From: Vladimir Stefanovic
Date: Wed, 20 Apr 2005 20:52
40 lines
2286 bytes
Look at ParamStr(0) or Application->ExeName.

Example:
   Path = ExtractFilePath( ParamStr(0) );
or:
   Path = ExtractFilePath( Application->ExeName );

-- 
Best regards,
Vladimir Stefanovic
"Marc" <bukwheat_NS@axess.com> wrote in message 
news:4266bf60@newsgroups.borland.com...
>
> Hi
>
> I am having an issue with retrieving the directory from where
> my application is started from, let me explain...
>
> GetModuleFileName and GetCurrentDirectory aren't cutting it for
> me.  GetMod... retruns the location of my exe as expected as
> for GetCurrentDirectory it works only when I am local on my
> system.
>
> Results from GetCurrentDirectory executions:
> My actual EXE resides on C:\program files\Somedirectory\Application.exe.
> 1. From the RUN dialog box GetCurrentDirectory return the location where 
> the EXE resides.
> 2. I have a batch file located on my desktop from which I
> execute the same command line as in the run command, in this
> case I get my desktop folder as expected.
> 3. Same batch file as the one on my desktop but this time I run
> it off a shared network path (\\somePC\SomeDirectory\file.bat
> in this case GetCurrectDirectory return C:\Windows.
>
> I have 2 questions, why C:\Windows and how can I have my
> application return the network path?
>
> Thanks for the help.
> Marc
> 
Technical Details
Message-ID: <4266c12e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4266bf60@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d14a13f082d61e40
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4266bf60@newsgroups.borland.com>
Subject: Re: Retrieving the Start from directory
Date: Wed, 20 Apr 2005 22:52:12 +0200
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.117.212.65
Message-ID: <4266c12e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1114030382 82.117.212.65 (20 Apr 2005 13:53:02 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail