How to get current program directory?

Use GetModuleFileName to get full path of executing program, and use PathRemoveFileSpec to remove file name part which leaves us with parent directory path of our program. Here is a sample function which does this… [sourcecode language=’cpp’]CString GetCurrentProgramParentDirectory() { // Get current modules full path TCHAR szModuleFileName[MAX_PATH] = { 0 }; GetModuleFileName( 0, szModuleFileName, MAX_PATH […]
Continue reading…