A CDialog class displays (a report) in a CFrameView window.
I am trying to display a messagebox when the user closes the FrameView, by posting a message to the dialog


pwnd->PostMessage(WM_U_CLOSE_REPORT); // user defined message




and trapping the message in the dialog (and then showing the messagebox)


BEGIN_MESSAGE_MAP(CRptSiCheckRegister, CToolDlg)
//{{AFX_MSG_MAP(CRptSiCheckRegister)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_U_CLOSE_REPORT, OnCloseReport)
END_MESSAGE_MAP()




This is supposed to stop the messgebox from displaying over the top of the FrameView.
I need the Dialog to produce the messagebox and NOT the FrameView.

The above WORKS perfectly in DEBUG mode, but throws a MFC42.DLL exception at run time in RELEASE mode.

Any ideas on either the fix - or a workaround.

Thanks,
Ian
[email protected]