Created
February 8, 2020 04:53
-
-
Save Jacob-Tate/81292ede52b7a2a7687171033876c9d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wchar_t path[FILENAME_MAX] = { 0 }; | |
GetModuleFileName(nullptr, path, FILENAME_MAX); | |
// "C:\path1" "C:\" | |
// "C:\path1\path2" "C:\path1" | |
// "C:\path1\" "C:\path1" | |
// "\\path1\path2\path3" "\\path1\path2" | |
// "\path1" "\" | |
// This removed the exe from get module file name | |
// see: https://docs.microsoft.com/en-us/windows/win32/api/pathcch/nf-pathcch-pathcchremovefilespec | |
PathCchRemoveFileSpec(path, FILENAME_MAX); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment