CHeaderCtrl::GetItem

BOOL GetItem( int nPos, HDITEM* pHeaderItem ) const;

Return Value

Nonzero if successful; otherwise 0.

Parameters

nPos

Specifies the zero-based index of the item to retrieve.

pHeaderItem

Pointer to an HDITEM structure that receives the new item. This structure is used with the InsertItem and SetItem member functions. Any flags set in the mask element ensure that values in the corresponding elements are properly filled in upon return. If the mask element is set to zero, values in the other structure elements are meaningless.

Remarks

Retrieves information about a header control item.

Example

// The pointer to my header control.
extern CHeaderCtrl* pmyHeaderCtrl;
// External strings.
extern LPCTSTR lpszmyString, lpszmyString2;

// Find the item whose text matches lpszmyString, and 
// replace it with lpszmyString2.
int    i, nCount = pmyHeaderCtrl->GetItemCount();
HDITEM hdi;
TCHAR  lpBuffer[256];
bool   fFound = false;

hdi.mask = HDI_TEXT;
hdi.pszText = lpBuffer;
hdi.cchTextMax = 256;

for (i=0;!fFound && (i < nCount);i++)
{
   pmyHeaderCtrl->GetItem(i, &hdi);
   
   if (strcmp(hdi.pszText, lpszmyString) == 0)
   {
      strcpy(hdi.pszText, lpszmyString2);
      pmyHeaderCtrl->SetItem(i, &hdi);
      fFound = false;
   }
}

CHeaderCtrl OverviewClass MembersHierarchy Chart

See Also   CHeaderCtrl::SetItem