Doc pointer in the MainFrame
How are you creating the document before the view? In a normal MFC app the
frame window, view, and document objects are all created by the call to
ProcessShellCommand in the application class InitInstance method.
The frame window method GetActiveDocument uses GetActiveView to find the
view first, then uses the views GetDocument method to find the document.
Therefore, this will not work if you have a document without a view.
Maybe you need to tuck away a pointer to the document at the time it is
MCSE, MCT, MVP
> I am trying to get a pointer to the Document in my Mainframe but I can't
> do that just by using GetActiveDocument.
> for somereason this only works if the view is already existing, but in
> my case the document is started then the Maingframe does some functions
> and at some point I need to use a function in the Document again while I
> am in the MainFrame, but I can't do that since my pointer is always
> I am running in an SDI environment and I pop-up some dialogs in the
> process of going from the Document to the MainFrame but all the dialogs
> are then destroyed before the next one is shown
> Please let me know if it is possible to access the Document from the
> MainFrame in a anyway possible.