Hello

I would like to be able to access files relative from the executables
location. At the moment, access will only work when the files are at
the root of My Device.

Whilst the PPC has no concept of current working directories, do you
have to hardcode in full paths in order to access files from where you
want, or is it possible to get some sort of current path for the
executable and work out the location relative from that ?

Nicholas

Re: File locations by Peter

Peter
Tue Mar 14 16:07:02 CST 2006

You can get the exe directory from reflection:-
http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ%2FStartupDirectory

Peter

--
Peter Foot
Windows Embedded MVP
www.peterfoot.net | www.inthehand.com

"Nicholas Kingsley" <z@z.com> wrote in message
news:4417372a$0$3640$ed2e19e4@ptn-nntp-reader04.plus.net...
> Hello
>
> I would like to be able to access files relative from the executables
> location. At the moment, access will only work when the files are at the
> root of My Device.
>
> Whilst the PPC has no concept of current working directories, do you have
> to hardcode in full paths in order to access files from where you want, or
> is it possible to get some sort of current path for the executable and
> work out the location relative from that ?
>
> Nicholas



Re: File locations by r_z_aret

r_z_aret
Tue Mar 14 17:05:54 CST 2006

On Tue, 14 Mar 2006 21:35:38 +0000, Nicholas Kingsley <z@z.com> wrote:

This question is asked every week or two. Unfortunately, in enough
different ways to make searching difficult. More below (in line).


>Hello
>
>I would like to be able to access files relative from the executables
>location. At the moment, access will only work when the files are at
>the root of My Device.
>
>Whilst the PPC has no concept of current working directories, do you
>have to hardcode in full paths in order to access files from where you
>want, or is it possible to get some sort of current path for the
>executable and work out the location relative from that ?

You need to use full paths. You can use GetModuleFilename function,
with NULL as the first argument, to get the full path to your
executable.


>
>Nicholas

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

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

Re: File locations by Nicholas

Nicholas
Wed Mar 15 05:30:37 CST 2006

In that case, as I use C, I suspect the current location is passed through
the WinMain parameters.

Nicholas

"Peter Foot [MVP]" <feedback@nospam-inthehand.com> wrote in message
news:eFAnfO7RGHA.336@TK2MSFTNGP12.phx.gbl...
> You can get the exe directory from reflection:-
> http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ%2FStartupDirectory
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> www.peterfoot.net | www.inthehand.com
>
> "Nicholas Kingsley" <z@z.com> wrote in message
> news:4417372a$0$3640$ed2e19e4@ptn-nntp-reader04.plus.net...
>> Hello
>>
>> I would like to be able to access files relative from the executables
>> location. At the moment, access will only work when the files are at the
>> root of My Device.
>>
>> Whilst the PPC has no concept of current working directories, do you have
>> to hardcode in full paths in order to access files from where you want,
>> or is it possible to get some sort of current path for the executable and
>> work out the location relative from that ?
>>
>> Nicholas
>
>



Re: File locations by r_z_aret

r_z_aret
Wed Mar 15 13:45:52 CST 2006

On Wed, 15 Mar 2006 11:30:38 -0000, "Nicholas Kingsley" <Moo@cow.farm>
wrote:

>In that case, as I use C, I suspect the current location is passed through
>the WinMain parameters.

I don't count on it, but can't remember whether I ever even tried. You
could write a quick test (pop up message box with lpCmdline). See my
other post for a better solution.


>
>Nicholas
>
>"Peter Foot [MVP]" <feedback@nospam-inthehand.com> wrote in message
>news:eFAnfO7RGHA.336@TK2MSFTNGP12.phx.gbl...
>> You can get the exe directory from reflection:-
>> http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ%2FStartupDirectory
>>
>> Peter
>>
>> --
>> Peter Foot
>> Windows Embedded MVP
>> www.peterfoot.net | www.inthehand.com
>>
>> "Nicholas Kingsley" <z@z.com> wrote in message
>> news:4417372a$0$3640$ed2e19e4@ptn-nntp-reader04.plus.net...
>>> Hello
>>>
>>> I would like to be able to access files relative from the executables
>>> location. At the moment, access will only work when the files are at the
>>> root of My Device.
>>>
>>> Whilst the PPC has no concept of current working directories, do you have
>>> to hardcode in full paths in order to access files from where you want,
>>> or is it possible to get some sort of current path for the executable and
>>> work out the location relative from that ?
>>>
>>> Nicholas
>>
>>
>

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

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

Re: File locations by Nicholas

Nicholas
Thu Mar 16 05:02:54 CST 2006

Thanks for the help!

Nicholas
<r_z_aret@pen_fact.com> wrote in message
news:hlng12ds0l6iovvqt00iglupcn1k5cm794@4ax.com...
> On Wed, 15 Mar 2006 11:30:38 -0000, "Nicholas Kingsley" <Moo@cow.farm>
> wrote:
>
>>In that case, as I use C, I suspect the current location is passed through
>>the WinMain parameters.
>
> I don't count on it, but can't remember whether I ever even tried. You
> could write a quick test (pop up message box with lpCmdline). See my
> other post for a better solution.
>
>
>>
>>Nicholas
>>
>>"Peter Foot [MVP]" <feedback@nospam-inthehand.com> wrote in message
>>news:eFAnfO7RGHA.336@TK2MSFTNGP12.phx.gbl...
>>> You can get the exe directory from reflection:-
>>> http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ%2FStartupDirectory
>>>
>>> Peter
>>>
>>> --
>>> Peter Foot
>>> Windows Embedded MVP
>>> www.peterfoot.net | www.inthehand.com
>>>
>>> "Nicholas Kingsley" <z@z.com> wrote in message
>>> news:4417372a$0$3640$ed2e19e4@ptn-nntp-reader04.plus.net...
>>>> Hello
>>>>
>>>> I would like to be able to access files relative from the executables
>>>> location. At the moment, access will only work when the files are at
>>>> the
>>>> root of My Device.
>>>>
>>>> Whilst the PPC has no concept of current working directories, do you
>>>> have
>>>> to hardcode in full paths in order to access files from where you want,
>>>> or is it possible to get some sort of current path for the executable
>>>> and
>>>> work out the location relative from that ?
>>>>
>>>> Nicholas
>>>
>>>
>>
>
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and
> please indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 20 Park Plaza, Suite 478
> Boston, MA 02116
> www.penfact.com