Page 1 of 1

Saving state in same directory as .EXE

PostPosted: Jul 15, 2002 @ 10:04pm
by britcode
I'd like to save the game in the same directory as the exe. I think this is probably a good idea in case the state gets quite large, so if they installed to Compact Flash it doesn't eat up RAM.

What do you think?

I'm also looking for ways to do this, because obviously there is not current directory. Is it possible to get the filename of the current process, perhaps with GetCurrentProcessID or something, or with GetCommandLine()? And then get the directory.

Anyone done this before and can advise The Right Way (tm)?

Finding the .exe's location

PostPosted: Jul 15, 2002 @ 10:42pm
by Conan
Taken from eVC help
The PocketPC function you need is:-

GetModuleFileName

This function gets a module file name.

WINAPI DWORD GetModuleFileName(
HMODULE hModule,
LPWSTR lpFilename,
DWORD nSize );
Parameters
hModule
[in] Handle to the module whose executable filename is being requested. If this parameter is NULL, GetModuleFileName returns the path for the file used to create the calling process.
[/code]

PostPosted: Jul 15, 2002 @ 10:51pm
by britcode
Thanks Conan, that was just what I was after!