Skip to content

Instantly share code, notes, and snippets.

@rzhukov
Created February 12, 2014 08:30
Show Gist options
  • Save rzhukov/8951859 to your computer and use it in GitHub Desktop.
Save rzhukov/8951859 to your computer and use it in GitHub Desktop.
Gets path to application
CString GetAppPath()
{
CString fullPath;
DWORD pathLen = ::GetModuleFileName( NULL, fullPath.GetBufferSetLength(MAX_PATH+1), MAX_PATH); // hmod of zero gets the main EXE
fullPath.ReleaseBuffer( pathLen );
PathRemoveFileSpec(fullPath.GetBuffer());
fullPath.ReleaseBuffer();
return fullPath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment