If you want to catch a tab change, the tab that will be active needs AFX_WM_CHANGE_ACTIVE_TAB , i.e.
ON_REGISTERED_MESSAGE(AFX_WM_CHANGE_ACTIVE_TAB,OnTabSetActive) LRESULT CYourClass::OnTabSetActive(WPARAM wParam, LPARAM lParam) { const int iActiveTab = (int)wParam; int iCheckActiveTab = m_wndTabs.GetActiveTab();
And if you need to manually change the tab call with;
SendMessage(AFX_WM_CHANGE_ACTIVE_TAB, iTabNum2ChangeTo, 0);
Sent above trying to find a solution to my problem when using
CMFCTabCtrl::SetActiveTab()
will fail, but only in debug mode. And this OP was googles best answer.
AFX_WM_CHANGING_ACTIVE_TAB appears to catch the event before the actual tab change, so why it did not work for the OP and can be checked:
int iCheckActiveTab = m_wndTabs.GetActiveTab();
source share