Solved

Receive notification of when a document window hosing a CHtmlView is closing.

Posted on 2004-04-07
2
388 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:Shake29
2 Comments
 
LVL 15

Accepted Solution

by:
lakshman_ce earned 250 total points
ID: 10776164
Try to Override
CHtmlView::OnDestroy()
{
}

-Lakshman
0
 

Author Comment

by:Shake29
ID: 10782996
I became a little confused having moved back to MFC after not working with it in years.

For the record, since I needed the WebBrowser control to still exist when the close event was called, it was actually the CFrameWnd::OnClose() that needed to be overridden, and it is works.

None the less, you answered the question correctly in the way it was asked.  So you get the points.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 65
Replacement selected text 2 58
List out all word 7 255
Problem to event 3 75
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now