BOOL GetItem( int nItem, TCITEM* pTabCtrlItem ) const;
Return Value
Returns TRUE if successful; FALSE otherwise.
Parameters
nItem
Zero-based index of the tab.
pTabCtrlItem
Pointer to a TCITEM structure, used to specify the information to retrieve. Also used to receive information about the tab. This structure is used with the InsertItem, GetItem, and SetItem member functions.
Remarks
Call this function to retrieve information about a tab in a tab control.
When the message is sent, the mask member specifies which attributes to return. If the mask member specifies the TCIF_TEXT value, the pszText member must contain the address of the buffer that receives the item text and the cchTextMax member must specify the size of the buffer.
mask
Value specifying which TCITEM structure members to retrieve or set. This member can be zero or a combination of the following values:
pszText
Pointer to a null-terminated string containing the tab text if the structure contains information about a tab. If the structure is receiving information, this member specifies the address of the buffer that receives the tab text.
cchTextMax
Size of the buffer pointed to by pszText. This member is ignored if the structure is not receiving information.
iImage
Index into the tab control’s image list, or – 1 if there is no image for the tab.
lParam
Application-defined data associated with the tab. If there are more than four bytes of application-defined data per tab, an application must define a structure and use it instead of the TCITEM structure. The first member of the application-defined structure must be a TCITEMHEADER structure. The TCITEMHEADER structure is identical to the TCITEM structure, but without the lParam member. The difference between the size of your structure and the size of the TCITEMHEADER structure should equal the number of extra bytes per tab.
Example
// In this example a CTabCtrl data member, m_tabCtrl, changes the
// text of the tabs in the tab control. A call to GetItem is used
// to get the current text, and then the text is changed. A call
// to SetItem is used to update the tab with the new text.
void CDialogDlg::OnChangeItem()
{
TCITEM tcItem;
CString pszString;
// Get text for the tab item.
GetDlgItemText(IDC_ITEM_TEXT, pszString);
// Get the current tab item text.
tcItem.mask = TCIF_TEXT;
m_tabCtrl.GetItem(0, &tcItem);
// Set the new text for the item.
tcItem.pszText = pszString.GetBuffer(256);
// Set the item in the tab control.
m_tabCtrl.SetItem(0, &tcItem);
}
CTabCtrl Overview | Class Members | Hierarchy Chart
See Also CTabCtrl::InsertItem, CTabCtrl::SetItem