The easiest way is simply to use MessageBoxW instead of MessageBox. MessageBoxW(e.getAllExceptionStr().c_str(), L"Error initializing the sound player"); The second easiest way is to create a new CString from the original; it will automatically convert to/from wide string and MBCS string as necessary. CString msg = e.getAllExceptionStr().c_str(); MessageBox(msg, _T("Error initializing the...
c++,wstring,lpcwstr,setdlldirectory
You are calling string_Dir() twice and then using iterators from different std::string objects to initialize your std::wstring. That is why you are getting an incompatibility error. You must use iterators from the same std::string object, so call string_Dir() once and assign the return value to a variable: std::string dir =...
windows,winapi,wchar-t,lpcwstr
I see at least these main issues: 1) wchar_t is the right type because you're compiling for UNICODE, you can write generic code using TCHAR macro or explicitly declare your buffer as wchar_t but that's what to do. 2) You have that error because you're passing wrong path to GetVolumeInformation()...