Preventing an MDI child from closing

I have an MDI application in which I want to get notified when a child is closing and then check to see if modifications were made.  If so, I want to put up a "Save? Yes, No, or Cancel" dialog and if they select cancel, prevent the child from closing.  OnDestroy in my view class is too late.  Any ideas?
skinAsked:
Who is Participating?
 
davmarcConnect With a Mentor Commented:
Sorry for not specifying - I meant you should try to override the OnClose() member of your frame window. It gets the WM_CLOSE message in place of the view.

Davide Marcato.
0
 
davmarcCommented:
If OnDestroy() is too late, what about OnClose()?
It gets called before OnDestroy().

Davide Marcato.
0
 
skinAuthor Commented:
I'm not sure why OnClose or WM_CLOSE are not one of the messages available in ClassWizard for my view class.  If I put in in by hand it does not appear to get called before (or after) OnDestroy.  I would have though it would have too.
Steve
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.