Please try the following. Open the CExtTabWnd::TAB_ITEM_INFO::ModifyItemStyle()
method and find these lines:
if( bNowVisible )
m_pWndTab->m_nVisibleItemCount ++;
else
m_pWndTab->m_nVisibleItemCount --;
Replace the above code with this:
if( bNowVisible )
{
if( m_pWndTab->m_nVisibleItemCount < m_pWndTab->m_arrItems.GetSize() )
m_pWndTab->m_nVisibleItemCount ++;
}
else
{
if( m_pWndTab->m_nVisibleItemCount > 0 )
m_pWndTab->m_nVisibleItemCount --;
}
Update the
OnTabWndSyncVisibility()
method in the
CExtTMWI
template. This should make the tab strip hidden when the number of visible tabs gets equal to zero.
virtual void OnTabWndSyncVisibility()
{
LONG nItemCount = ItemGetCount();
LONG nItemVisibleCount = ItemGetVisibleCount();
DWORD dwWndStyle = GetStyle();
if( nItemCount > 0
&& nItemVisibleCount > 0
&& (!( CExtControlBar::FindPrintPreviewMode(
STATIC_DOWNCAST( CFrameWnd, GetParent() )
)
|| CExtControlBar::IsOleIpObjActive(
STATIC_DOWNCAST( CFrameWnd, GetParent() )
)
) )
)
{
if( (dwWndStyle & WS_VISIBLE) == 0 )
{
::SetWindowPos(
m_hWnd,
NULL, 0, 0, 0, 0,
SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
|SWP_FRAMECHANGED
|SWP_SHOWWINDOW
);
HWND hWndMdiArea = _GetHwndMdiArea();
if( hWndMdiArea != NULL )
::SetWindowPos(
hWndMdiArea,
NULL, 0, 0, 0, 0,
SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
|SWP_FRAMECHANGED
);
}
} // if( nItemCount > 0 ...
else
{
if( (dwWndStyle & WS_VISIBLE) != 0 )
::SetWindowPos(
m_hWnd,
NULL, 0, 0, 0, 0,
SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
|SWP_NOSENDCHANGING
|SWP_HIDEWINDOW
);
} // else from if( nItemCount > 0 ...
dwWndStyle = GetStyle();
if( (dwWndStyle & WS_VISIBLE) == 0 )
m_nIndexVisFirst = m_nIndexVisLast = -1;
}