[英]cannot convert 'const wchar_t*' to 'LPCSTR' {aka 'const char*'}
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()); 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;
}
You can use MessageBoxW
function to use wide characters in MessageBox.您可以使用MessageBoxW
function 在 MessageBox 中使用宽字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.