How would you make your program get its current filename (in case someone renamed it)?
Posted on 2003-08-07 16:28:11 by psyphen
GetModuleFileName will do that for you

DWORD GetModuleFileName(
HMODULE hModule,
LPTSTR lpFilename,

Handle to the module whose path is being requested. If this parameter is NULL, GetModuleFileName retrieves the path for the current module.
Pointer to a buffer that receives a null-terminated string that specifies the fully-qualified path of the module. If the length of the path exceeds the size specified by the nSize parameter, the function succeeds and the string is truncated to nSize characters and null terminated.
The path can have the prefix "\\?\", depending on how the module was loaded. For more information, see Naming a File.

Size of the lpFilename buffer, in TCHARs.
Posted on 2003-08-07 16:30:06 by Gunner