How do I retrieve the current program's start-up directory in Win32 C?
>How do I retrieve the current program's start-up directory in Win32 C? Just use magic Harry. ... alternatively... If you're looking for the start-up directory, it'll be what GetCurrentDirectory returns at the start of your application. If you're actually looking for the directory the EXE is in, use GetModuleFileName with a NULL module handle and parse the resultant path to get the directory. Dave
On Sep 7, 3:46 pm, Harry Potter wrote: > How do I retrieve the current program's start-up directory in > Win32 C? GetCurrentDirectory (before you've changed it to something else, of course). http://msdn.microsoft.com/en-us/library/aa364934(VS.85).aspx Richard. http://www.rtrussell.co.uk/ To reply by email change 'news' to my forename.
I's quite possible the current directory is not the EXE dir. That might happen very often, for example, if the exe was started by opening an associated document file. "David Lowndes" <DavidL@example.invalid> wrote in message news:mvq7c4t152i4n9ojg3kq8eej6553e0oqff@4ax.com... > >How do I retrieve the current program's start-up directory in Win32 C? > > Just use magic Harry. > > ... alternatively... > > If you're looking for the start-up directory, it'll be what > GetCurrentDirectory returns at the start of your application. If > you're actually looking for the directory the EXE is in, use > GetModuleFileName with a NULL module handle and parse the resultant > path to get the directory. > > Dave
>I's quite possible the current directory is not the EXE dir. I know. The OP asked for the "start-up directory". Dave
People often mean either "EXE directory" and/or "current directory"when they ask for "startup" directory. "David Lowndes" <DavidL@example.invalid> wrote in message news:s30ac4p6mcnnldiktpc68a8rurid68jt40@4ax.com... > >I's quite possible the current directory is not the EXE dir. > > I know. The OP asked for the "start-up directory". > > Dave
>People often mean either "EXE directory" and/or "current directory"when they >ask for "startup" directory. Which is why I gave both possible answers in my original reply :) Dave
On Sep 8, 2:10 am, "Alexander Grigoriev" wrote: > I's quite possible the current directory is not the EXE dir. That > might happen very often, for example, if the exe was started by > opening an associated document file. Or simply by running the EXE by means of a shortcut, in which case the 'startup' directory is set according to the 'Start in:' property. Richard. http://www.rtrussell.co.uk/ To reply by email change 'news' to my forename.