Inside my app, I want to send a message to a dialog from a different thread. I want to pass an std::exception derived class reference to the dialog.
Something like this:
try {
//do stuff
}
catch (MyException& the_exception) {
PostMessage(MyhWnd, CWM_SOME_ERROR, 0, 0); //send the_exception or the_exception.error_string() here
}
I want to receive the message in my dialog and show the error that is in the_exception.error_string()
LPARAM CMyDlg::SomeError(WPARAM, LPARAM)
{
show_error( ?????
return 0;
}
passing the std::string the_exception.error_string()
using PostMessage would also be ok, I guess.
PostMessage
can be resulted with error because of the messages queue is full. Or, the target window may be already destroyed (so, thedelete
operator will not be called). May you suggest variants, how we can be safe against the memory leakage? – Warring