?
Solved

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

Posted on 2004-04-07
2
Medium Priority
?
435 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
lakshman_ce earned 750 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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 6 hours left to enroll

765 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