AssemblyDocument and Assembly.Document Assembly

Top  Previous  Next

Here's how to get it...

 

CComPtr<Document> pDoc;

HRESULT Result = pInvApp->get_ActiveDocument(&pDoc);

if ((FAILED(iRes) || (pDoc == NULL)) {

    TRACE ("No document is open");

    return Result ;

}

 

// Try to cast the 

if (CComQIPtr<AssemblyDocument> pAssemblyDoc = pDoc)

{

    TRACE ("This is an assembly\n");

}

 

...basically you check to see if the cast (in red) returns something other than nullptr.

 

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