Reputation: 1
Please help me with this code, I don't know how to change it so I can fix it and run it
std::wstring stemp = std::wstring(filename.begin(), filename.end());
hBitmapG = (HBITMAP)LoadImage(GetModuleHandle(NULL), stemp.c_str(), IMAGE_BITMAP,
0, 0, LR_LOADFROMFILE);
if (!hBitmapG) {
DWORD err = GetLastError();
std::wstring errorMsg = L"Failed to LoadImage - '" + stemp + L"', error code (" + std::to_wstring((long long)err) + L")";
MessageBox(NULL, errorMsg.c_str(), L"WinCanvas::DrawBitmap()", MB_OK);
PostMessage(hWnd, WM_DESTROY, NULL, NULL); // Post a message to destroy (shutdown) the program
return FALSE;
}
Upvotes: -2
Views: 67
Reputation: 61
You can use MessageBoxW
function to use wide characters in MessageBox.
Upvotes: 1