Reputation: 1097
Here is my code:
TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");
GetModuleFileNameEx (hProcess, NULL, szProcessName,
sizeof(szProcessName)/sizeof(TCHAR));
I need the path in char*
, and not in TCHAR[]
. Is it somehow possible without converting (WideCharToMultiByte)
?
Thanks...
Upvotes: 1
Views: 3020
Reputation: 3281
Note that if you're not building a Unicode application (i.e., _UNICODE is not defined), then TCHAR == char
Upvotes: 0
Reputation: 99555
GetModuleFileNameEx is just a macro. You could use GetModuleFileNameExA for ANSI version. It will call GetModuleFileNameExW and then internally make all conversions.
But you should make sure that module filename does not contain Unicode characters.
char szProcessName[MAX_PATH] = "<unknown>";
GetModuleFileNameExA(hProcess, NULL, szProcessName, sizeof szProcessName);
Upvotes: 6