I keep getting this error message:
State Error C2664 -- int MessageBoxW(HWND,LPCWSTR,LPCWSTR,UINT)': cannot convert argument 2 from 'const char *' to 'LPCWSTR' " 31
This is my code below. I understand it has to do with passing a const type through the what()
function in the error class. For some reason it's incompatible. Any ideas?
// on startup execute to determine exceptions
try
{
// instantiate object app of class AppWindow
AppWindow app;
// if(initialize function in class app is executed, and while the app is running, broadcast app)
if (app.init())
{
while (app.isRun())
{
app.broadcast();
}
}
}
// if the following error is found, execute MessageBox function with following parameters
catch (const std::runtime_error& error)
{
// parameters(has no owner window so displays independently)
MessageBox(nullptr, error.what(), L"An error has occured", MB_OK);
}
return 0;