Solved

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

Posted on 2004-04-07
2
404 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.

696 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