내 응용 프로그램 내에서 다른 스레드의 대화 상자에 메시지를 보내려고합니다. 대화 상자에 std :: exception 파생 클래스 참조를 전달하려고합니다. 이 같은PostMessage를 통해 문자열을 보내는 방법은 무엇입니까?
뭔가 :
try {
//do stuff
}
catch (MyException& the_exception) {
PostMessage(MyhWnd, CWM_SOME_ERROR, 0, 0); //send the_exception or the_exception.error_string() here
}
내가, the_exception.error_string()
LPARAM CMyDlg::SomeError(WPARAM, LPARAM)
{
show_error(?????
return 0;
}
도 괜찮을 것 PostMessage를를 사용하여 std::string the_exception.error_string()
전달에 오류를 내 대화 상자에서 메시지를 수신하고 보여주고 싶은 추측.
안녕하세요, 답장을 보내 주셔서 감사합니다. LPARAM에 캐스트를 잊어 버렸습니다. PostMessage (MyhWnd, CWM_SOME_ERROR, 0, reinterpret_cast (새 문자열 (the_exception.error_string)))); 대신 auto_ptr을 사용하는 방법 : std :: auto_ptr msg (reinterpret_cast (lParam)); 소유권 이전을 나타내므로 –
rec
서식이 잘못되었습니다. 줄 바꿈 테스트 줄 바꿈 테스트 – rec
메모리 누수가 아닙니까? 새 문자열()을 어디에서 파기하고 있습니까? –