The TCM_GETITEMCOUNT message retrieves the number of tabs in the tab control. You can send this message explicitly or by using the TabCtrl_GetItemCount macro.
TCM_GETITEMCOUNT wParam = 0; // not used; must be zero lParam = 0; // not used; must be zero
Returns the number of items if successful or zero otherwise.