listen for events in c++
I got a CWnd like thie CWnd * pWnd = pDC->GetWindow();
Is开发者_JAVA技巧 there away I can be notified when the windows is closing?
Yes, you can use Windows Hooks.
http://msdn.microsoft.com/en-us/library/ms632589(VS.85).aspx
I've not done MFC for years so don't know if this will work but can you:
- call CWnd::Detach() to get the handle of the window
- Attach it to your own derived CWnd, with a CWnd::Attach() and have an override of afx_msg void OnClose( );
精彩评论