Does anyone know of a way to convert a string to a 'const wchar_t*'
I need this conversion for the 3rd parameter in MessageBox(...).
MessageBox(NULL,
apstr.c_str(), // Thius works
(const wchar_t*)this-getMessage().c_str(),// getMessage()
returns a std:string, it does
Incongruous писал 2013-11-01 00:36:
Does anyone know of a way to convert a string to a 'const wchar_t*'
I need this conversion for the 3rd parameter in MessageBox(...).
MessageBox(NULL,
apstr.c_str(), // Thius works
(const wchar_t*)this-getMessage().c_str(),//
http://msdn.microsoft.com/en-us/library/windows/desktop/dd319072(v=vs.85).aspx
Or use MessageBoxA() instead of MessageBox()
--
Regards, niXman
___
Dual-target(32 64-bit) MinGW-W64 compilers for 32 and 64-bit Windows:
Use this to get a wstring, then call c_str() and you have a const wchar_t*:
const wstring convert_to_utf16(const string utf8_string)
{
// get length
int length = MultiByteToWideChar(CP_UTF8, 0, utf8_string.c_str(),
static_castint(utf8_string.size()), nullptr, 0);
if(!(length 0))
return
2013/10/31 Ruben Van Boxem vanboxem.ru...@gmail.com
Use this to get a wstring, then call c_str() and you have a const wchar_t*:
const wstring convert_to_utf16(const string utf8_string)
{
// get length
int length = MultiByteToWideChar(CP_UTF8, 0, utf8_string.c_str(),