CTabCtrl::InsertItem

BOOL InsertItem( int nItem, TCITEM* pTabCtrlItem );

BOOL InsertItem( int nItem, LPCTSTR lpszItem );

BOOL InsertItem( int nItem, LPCTSTR lpszItem, int nImage );

BOOL InsertItem( UINT nMask, int nItem, LPCTSTR lpszItem, int nImage, LPARAM lParam );

Return Value

Zero-based index of the new tab if successful; otherwise  – 1.

Parameters

nItem

Zero-based index of the new tab.

pTabCtrlItem

Pointer to a TCITEM structure that specifies the attributes of the tab.

lpszItem

Pointer to the item to insert.

nImage

The zero-based index of an image to insert from an image list.

nMask

Specifies which TCITEM structure attributes to set. Can be zero or a combination of the following values:

lParam

Application-defined data associated with the tab.

Remarks

Call this function to insert a new tab in an existing tab control.

Example

BOOL CDialogDlg::OnInitDialog()
{
   // Other initialization.
   
   TCITEM tcItem;
   tcItem.mask = TCIF_TEXT;
   tcItem.pszText = _T("Tab #1");

   m_tabCtrl.InsertItem(0, &tcItem);
   
   return TRUE;  // Return TRUE unless you set the focus to a control.
}

CTabCtrl OverviewClass MembersHierarchy Chart

See Also   CTabCtrl::GetItem, CTabCtrl::SetItem