get_ActiveDocument |
Top Previous Next |
The active document can be one of many types. Here is an example call:
CComPtr<Document> pDoc; HRESULT hRes=pApplication->get_ActiveDocument(&pDoc);
get_ActiveDocument will put NULL in pDoc if there is no document open. You have to check that as well as hRes:
CComPtr<Document> pDoc; HRESULT hRes = pInvApp->get_ActiveDocument(&pDoc); if (FAILED(hRes) || (pDoc == nullptr)) { ShowCOMError(hRes,L"Get Active Document Failed"); return ; }
|
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)