CurrentDirectory of an app

CurrentDirectory of an app

Post by Rober » Wed, 26 Nov 2003 03:48:57


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
 
 
 

CurrentDirectory of an app

Post by Peter Foot » Wed, 26 Nov 2003 04:15:16

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://www.yqcomputer.com/ #7.1

Peter

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

 
 
 

CurrentDirectory of an app

Post by Tashkan » Wed, 26 Nov 2003 06:03:12

GetModulePath() will do the trick.
 
 
 

CurrentDirectory of an app

Post by r_z_are » Wed, 26 Nov 2003 23:23:17

On Mon, 24 Nov 2003 10:48:57 -0800, "Robert" < XXXX@XXXXX.COM >



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.


-----------------------------------------
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