IMxDocument is not the same as IApplication, they are in two different co-classes. The document is derived from the application so you can't cast a document as application but you can cast the parent of the document as application because the parent of a document is the application. Hopefully that explanation helps.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.