GetAnnotationMarkCount Example VC++

This example shows some methods for determining the number and types of annotations on a page.

void CImgEdit1Dlg::OnGetCount() 
{
    // Some methods for determining the number and types of
    // annotations on a page.

    int iMarkCount;
    CString szCurGroup("accounting");

    VARIANT evt; V_VT(&evt) = VT_ERROR; // set to default
    VARIANT vCurGroup; V_VT(&vCurGroup) = VT_BSTR;V_BSTR(&vCurGroup) =
     szCurGroup.AllocSysString();
    VARIANT vCurType; V_VT(&vCurType) = VT_I2;

    // Returns a count of all marks on the page displayed.
    iMarkCount = ImgEdit1.GetAnnotationMarkCount(evt,evt);
    
    // Returns a count of all marks in the annotation group called
    // accounting.
    iMarkCount = ImgEdit1.GetAnnotationMarkCount(vCurGroup,evt);
    
    // Returns a count of all OCR regions.
    V_I2(&vCurType) = 12;  // wiOcrRegion
    iMarkCount = ImgEdit1.GetAnnotationMarkCount(evt, vCurType);
    
    // Returns a count of all text annotation marks in the
    // annotation group called "accounting".
    V_I2(&vCurType) = 7;   // wiText
    iMarkCount = ImgEdit1.GetAnnotationMarkCount(vCurGroup, vCurType);
}