Receive notification of when a document window hosing a CHtmlView is closing.
Posted on 2004-04-07
I cannot seem to receive any event notification of when i am closing a document window whose child view is a CHtmlView.
The HTML page captures the OnBeforeUnload event, and it gets called successfully if you navigate to another page. But unlike when you close an Internet Explorer browser window, the OnBeforeUnload event does not get called on the HTML page when you close SDI or MDI documents hosing a CHtmlView. The document window and HTML page just shut down.
This is not a problem if my application can receive a notification before the window closes and is the prefered method anyways.
I've tried these things to receive notification of a document window closing....
1) Overrided CDoc::OnDocumentCLose()
-- probably doesn't work because i don't use or need serialization
2) Overrided CWnd::OnClose()
-- manually added it to the message map because Class Wizard did not offer it.
3) Overrided CHtmlView::OnBeforeNavigate2()
-- I was already certain it would not get called.
None of these events get called when i close the document window.