The DocumentOpening event fires at the VERY start of a document being opened. There is no promise that the document will be opened, hence a documentOpened event may not follow.
 When a document is being opened that references other documents, only the top-level document will cause a documentOpening event to be fired.
-------- Import ----------------- Global variables --------- -------- Connect the handler to the event. --------- -------- Event handler function definition ---------  | 
        
-------- Global variables ----------------- Connect the handler to the event. --------- -------- Event handler class definition ---------  | 
        
--------- Required include files. ------------------ Event handler class definition and global declaration. --------- class MyDocumentOpeningEventHandler : public adsk::core::DocumentEventHandler { public: void notify(const Ptr<DocumentEventArgs>& eventArgs) override { // Code to react to the event. ui->messageBox("In MyDocumentOpeningEventHandler event handler."); } } _documentOpening; --------- Connect the handler to the event. ---------  |