Click here to Skip to main content
16,006,768 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: NM_CLICK problems Pin
Joaquín M López Muñoz12-Nov-03 10:18
Joaquín M López Muñoz12-Nov-03 10:18 
GeneralRe: NM_CLICK problems Pin
ns13-Nov-03 2:30
ns13-Nov-03 2:30 
GeneralRe: NM_CLICK problems Pin
David Crow12-Nov-03 10:55
David Crow12-Nov-03 10:55 
GeneralRe: NM_CLICK problems Pin
ns13-Nov-03 2:49
ns13-Nov-03 2:49 
GeneralCD-ROM Pin
Alexander M.,12-Nov-03 9:26
Alexander M.,12-Nov-03 9:26 
GeneralRe: CD-ROM Pin
Joaquín M López Muñoz12-Nov-03 10:22
Joaquín M López Muñoz12-Nov-03 10:22 
GeneralUnhandled Exception Pin
mcquilkenm12-Nov-03 7:27
mcquilkenm12-Nov-03 7:27 
GeneralRe: Unhandled Exception Pin
John M. Drescher12-Nov-03 8:35
John M. Drescher12-Nov-03 8:35 
First thing to do is make your application so that it does not exit after an unhandled exception. Put a cach handler in your main application. If it is an MFC application override ProcessWndProcException(CException* e, const MSG* pMsg) in your application class and log the error so if it happens again you may be able to figure out what happened.
LRESULT CCommonAppBase::ProcessWndProcException(CException* e, const MSG* pMsg) 
{
	if ( e->GetErrorMessage(szError,MAX_PATH) ) {
                   Log("FATAL ERROR(%s): %s",_T("CCommonAppBase"),szError);		}
	return CWinApp::ProcessWndProcException(e, pMsg);
}

Override PumpMessage() and call CWinApp::PumpMessage(); inside a try catch block.
BOOL CCommonAppBase::PumpMessage()
{
	BOOL retVal = TRUE;
	try {
		retVal = CWinApp::PumpMessage();
	}
	catch(CException* e) {
		TCHAR szError[MAX_PATH];
		if ( e->GetErrorMessage(szError,MAX_PATH) ) {
                   Log("FATAL ERROR(%s): %s",_T("CCommonAppBase"),szError);
		}
		e->Delete();
	}
	catch(...){
	}
	return retVal;
}

Use SEH and C++ Exceptions - catch all in one http://www.codetools.com/cpp/seexception.asp[^]. And activate it in your ::InitInstance().
BOOL CCommonAppBase::InitInstance() 
{
	_set_se_translator(SeTranslator);
	return CWinApp::InitInstance();
}

John
GeneralLaunching mail client, open new message and add attachments Pin
Daniel 'Tak' M.12-Nov-03 7:23
Daniel 'Tak' M.12-Nov-03 7:23 
GeneralRe: Launching mail client, open new message and add attachments Pin
David Crow12-Nov-03 8:02
David Crow12-Nov-03 8:02 
GeneralRe: Launching mail client, open new message and add attachments Pin
Daniel 'Tak' M.12-Nov-03 8:21
Daniel 'Tak' M.12-Nov-03 8:21 
GeneralRe: Launching mail client, open new message and add attachments Pin
David Crow12-Nov-03 9:36
David Crow12-Nov-03 9:36 
GeneralRe: Launching mail client, open new message and add attachments Pin
Daniel 'Tak' M.12-Nov-03 9:51
Daniel 'Tak' M.12-Nov-03 9:51 
GeneralRe: Launching mail client, open new message and add attachments Pin
Michael Dunn12-Nov-03 8:25
sitebuilderMichael Dunn12-Nov-03 8:25 
GeneralRe: Launching mail client, open new message and add attachments Pin
Roger Allen13-Nov-03 1:45
Roger Allen13-Nov-03 1:45 
GeneralWord Wrap Pin
georgiek5012-Nov-03 7:11
georgiek5012-Nov-03 7:11 
GeneralRe: Word Wrap Pin
David Crow12-Nov-03 7:23
David Crow12-Nov-03 7:23 
GeneralRe: Word Wrap Pin
georgiek5012-Nov-03 8:50
georgiek5012-Nov-03 8:50 
GeneralRe: Word Wrap Pin
David Crow12-Nov-03 9:38
David Crow12-Nov-03 9:38 
GeneralRe: Word Wrap Pin
georgiek5012-Nov-03 11:52
georgiek5012-Nov-03 11:52 
GeneralTVN_SELCHANGED problems Pin
LukeV12-Nov-03 6:46
LukeV12-Nov-03 6:46 
GeneralRe: TVN_SELCHANGED problems Pin
David Crow12-Nov-03 6:50
David Crow12-Nov-03 6:50 
GeneralRe: TVN_SELCHANGED problems Pin
LukeV12-Nov-03 6:56
LukeV12-Nov-03 6:56 
GeneralRe: TVN_SELCHANGED problems Pin
David Crow12-Nov-03 7:09
David Crow12-Nov-03 7:09 
GeneralRe: TVN_SELCHANGED problems Pin
LukeV12-Nov-03 7:11
LukeV12-Nov-03 7:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.