Subclassing CDateTimeCtrl
-
Created and editable CListCtrl. Trying to subclass CDateTimeCtrl - unable to handle using VK_TAB and forcing the subclassed control to lose focus and destroy itself. Reasoning: When using the drop-down, obviously, CDateTimeCtrl loses focus, but can't figure out how to keep control visible until all user intervention is complete - or naturally, it loses focus to the next column, or other object. I tried overiding OnKillFocus: void CdtkDate::OnKillFocus(CWnd* pNewWnd) { CDateTimeCtrl::OnKillFocus(pNewWnd); CMonthCalCtrl* pMonCalCtrl = this->GetMonthCalCtrl(); // But CMonthCalCtrl doesn't get focus until the user selects it, // Even though it is visible - should I force this focus? if(pNewWnd->m_hWnd == pMonCalCtrl->m_hWnd) return; DestroyWindow(); } This Class will not always destroy itself - and I get an error when the application instance is terminated. Any suggestions will be appreciated.