The TCM_GETCURFOCUS message returns the index of the item that has the focus in a tab control. You can send this message explicitly or by using the TabCtrl_GetCurFocus macro.
TCM_GETCURFOCUS wParam = 0; // not used; must be zero lParam = 0; // not used; must be zero
Returns the index of the tab item that has the focus
The item that has the focus may be different than the selected item.