How to assign a custom icon to the tab that represents an auto-hidden control bar or a control bar tabbed with other control bars?

Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

The icon on any tab item is associated with the command corresponding to the control bar that is docked into the tab container. This icon is stored in the command manager. The command identifier is equal to the control identifier of the control bar window. Please use the following code to change the icon:

HICON hSomeNewIcon = (HICON)
    ::LoadImage(
        ::AfxGetResourceHandle(),
        MAKEINTRESOURCE( IDR_SOME_ICON_RESOURCE ),
        IMAGE_ICON,
        16,
        16,
        0
        );
ASSERT( hSomeNewIcon != NULL );
UINT nCmdID = (UINT) pSomeBar->GetDlgCtrlID();
VERIFY(
    g_CmdManager->CmdSetIcon(
        g_CmdManager->ProfileNameFromWnd(
            pSomeBar->GetSafeHwnd()
            ),
        nCmdID,
        hSomeNewIcon,
        false
        )
    );
if( pSomeBar->IsVisible() )
    pSomeBar->GetParentFrame()->RecalcLayout();