The framework calls this member function to inform CWnd to cancel any internal mode.
afx_msg void OnCancelMode( );
If the CWnd object has the focus, its OnCancelMode member function is called when a dialog box or message box is displayed. This gives the CWnd the opportunity to cancel modes such as mouse capture.
The default implementation responds by calling the ReleaseCapture Windows function. Override this member function in your derived class to handle other modes.