January 17, 2004
I'm having some difficulty getting file i/o to work to my satisfaction.

When my program starts up it has to load a few data files. Sometimes when a user starts the program, rather then the program loading the files from the same directory that it resides in, it ends up going to the last folder the user accessed. The program then reports an error as it could not find the files!

In a similar manner, if the user saves a file all subsequent loads and saves will begin at the directory just accessed!

Please help, I'm sure there is something very simple that I am missing.

Steve De Chellis
www.hmtk.com




January 17, 2004
For your first question, use GetModuleFilename to figure out where your program is.

For your second question, use the lpstrInitialDir field in your OPENFILENAME structure.



"Steve" <steve@hmtk.com> wrote in message news:bua4ou$2o7m$1@digitaldaemon.com...
> I'm having some difficulty getting file i/o to work to my
satisfaction.
>
> When my program starts up it has to load a few data files.
Sometimes when a
> user starts the program, rather then the program loading
the files from the
> same directory that it resides in, it ends up going to the
last folder the
> user accessed. The program then reports an error as it
could not find the
> files!
>
> In a similar manner, if the user saves a file all
subsequent loads and saves
> will begin at the directory just accessed!
>
> Please help, I'm sure there is something very simple that
I am missing.
>
> Steve De Chellis
> www.hmtk.com
>
>
>
>