tags:

views:

55

answers:

2

Hi

I got a CWnd like thie CWnd * pWnd = pDC->GetWindow(); Is there away I can be notified when the windows is closing?

+1  A: 

I've not done MFC for years so don't know if this will work but can you:

  1. call CWnd::Detach() to get the handle of the window
  2. Attach it to your own derived CWnd, with a CWnd::Attach() and have an override of afx_msg void OnClose( );
Preet Sangha
+1  A: 

Yes, you can use Windows Hooks.

http://msdn.microsoft.com/en-us/library/ms632589(VS.85).aspx

Pavel Radzivilovsky