Share via


COleDocument::GetNextItem

Call this function repeatedly to access each of the items in your document.

virtual CDocItem* GetNextItem(
   POSITION& pos 
) const; 

Parameters

  • pos
    A reference to a POSITION value set by a previous call to GetNextItem; the initial value is returned by the GetStartPosition member function.

Return Value

A pointer to the document item at the specified position.

Remarks

After each call, the value of pos is set to the POSITION value of the next item in the document. If the retrieved element is the last element in the document, the new value of pos is NULL.

Example

// pDoc points to a COleDocument object
POSITION pos = pDoc->GetStartPosition();
CDocItem *pItem;
CString strType;
while(pos != NULL)
{
   pItem = pDoc->GetNextItem(pos);
   // Use pItem
   if (pItem->IsKindOf(RUNTIME_CLASS(COleClientItem)))
   {
      ((COleClientItem*)pItem)->GetUserType(USERCLASSTYPE_FULL, strType);
      TRACE(strType);
   }
}

Requirements

Header: afxole.h

See Also

Reference

COleDocument Class

Hierarchy Chart

COleDocument::GetStartPosition

COleDocument::GetNextClientItem

COleDocument::GetNextServerItem

Other Resources

COleDocument Members