• Advertisement
Sign in to follow this  

Checking program path C++, Win32

This topic is 3858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
You can use GetModuleFileName() with a HMODULE of 0.

Share this post


Link to post
Share on other sites
This function in VS2005 is superseded by GetModuleFileNameW, which returns wide chars. How can I use the orignal, with normal chars? If I can't, how can I easily convert wide chars to c chars?

Share this post


Link to post
Share on other sites
Either go to your project settings, under general and change the character set from Unicode to multi-byte, explicitly use GetModuleFileNameA or you can use wcstombs() to translate wide characters to narrow characters. (Or if you feel like the C++ method, the narrow() member function of the ctype locale facet.)

Share this post


Link to post
Share on other sites
Wow, man! You impress me. You seem to know every little technical detail. So many ways to solve one little problem. Big thx :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement