Skipping missing components programatically

Top  Previous  Next

When looping over occurrences you must skip any missing components, and you do it like this:

 

 

   for (lOccCount=1; lOccCount <= lNoOccs; ++lOccCount) {

       // Get the nth occurrence...

       CComPtr<ComponentOccurrence> pCompOcc;

       hRes = pOccs->get_Item(lOccCount, &pCompOcc);

       if (FAILED(hRes)) {

           gLogger.Printf(ekErrMsg, L"Could not get a component in the attacco");

           return false;

       }

 

       if (VARIANT_TRUE == pCompOcc->ReferencedDocumentDescriptor->ReferenceMissing) {

           // Maybe a missing and skipped component...

           continue ;

       }

 

.

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)