Hi,

how to get the "CurrentDirectory" of an app.

I want to open a file in the apps dir.

... new System.IO.FileStream( ?? + "\\filename.txt") ...

Regards
Robert Holler

Re: CurrentDirectory of an app by Peter

Peter
Mon Nov 24 13:15:16 CST 2003

Windows CE does not have the notion of CurrentDirectory, however you can
determine the directory in which your application exists using Reflection -
see this entry in the FAQ for details:-
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/faq/default.aspx#7.1

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

"Robert" <holler@ergo-soft.com> wrote in message
news:0cca01c3b2bb$9e304d60$3101280a@phx.gbl...
> Hi,
>
> how to get the "CurrentDirectory" of an app.
>
> I want to open a file in the apps dir.
>
> ... new System.IO.FileStream( ?? + "\\filename.txt") ...
>
> Regards
> Robert Holler



Re: CurrentDirectory of an app by Tashkant

Tashkant
Mon Nov 24 15:03:12 CST 2003

GetModulePath() will do the trick.

"Robert" <holler@ergo-soft.com> wrote in message
news:0cca01c3b2bb$9e304d60$3101280a@phx.gbl...
> Hi,
>
> how to get the "CurrentDirectory" of an app.
>
> I want to open a file in the apps dir.
>
> ... new System.IO.FileStream( ?? + "\\filename.txt") ...
>
> Regards
> Robert Holler



Re: CurrentDirectory of an app by r_z_aret

r_z_aret
Tue Nov 25 08:23:17 CST 2003

On Mon, 24 Nov 2003 10:48:57 -0800, "Robert" <holler@ergo-soft.com>
wrote:

>Hi,
>
>how to get the "CurrentDirectory" of an app.
>
>I want to open a file in the apps dir.
>
>... new System.IO.FileStream( ?? + "\\filename.txt") ...
>

The Win32 API includes a function called GetModuleFileName. If you
pass it NULL as the first argument, it will fetch the full path for
the executable that started the process. You can then parse the full
path to get whatever pieces you want.

>Regards
>Robert Holler

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com