afx_msg void OnDestroy();
Called to inform the CWnd that it is being destroyed. OnDestroy is called after the CWnd object is removed from the screen.
OnDestroy is called first for the CWnd being destroyed, then for the child windows of CWnd as they are destroyed. It can be assumed that all child windows still exist while OnDestroy runs.
If the CWnd is the main window (CWinApp's m_pMainWnd) then OnDestroy calls PostQuitMessage.
If the CWnd object being destroyed is part of the Clipboard-viewer chain (set by calling the SetClipboardViewer member function), the CWnd must remove itself from the Clipboard-viewer chain by calling the ChangeClipboardChain member function before returning from the OnDestroy function.
CWnd::ChangeClipboardChain, CWnd::DestroyWindow, ::PostQuitMessage, CWnd::SetClipboardViewer, WM_DESTROY