MDI - Access to Doc From MainFrame
-
I have an application where I need to access the doc page and put data there from a function that is part of the mainframe.cpp file. I know how to access the doc page from the view...but I am not doing that in this application. Also, can someone show me a simple SDI or MDI program where I can pass messages between classes, using handles to a class...forward referencing , etc, as is done in a typ C++ program with a main(). Thanks. jerry1211a jerry1211a
-
I have an application where I need to access the doc page and put data there from a function that is part of the mainframe.cpp file. I know how to access the doc page from the view...but I am not doing that in this application. Also, can someone show me a simple SDI or MDI program where I can pass messages between classes, using handles to a class...forward referencing , etc, as is done in a typ C++ program with a main(). Thanks. jerry1211a jerry1211a
Hi jerry here is the code to access doc page from mainframe.cpp ///////////////////////////////////////////////////////////// //get main wnd handle CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; // Get the active MDI child window. CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); // or CMDIChildWnd *pChild = pFrame->MDIGetActive(); // Get the active view attached to the active MDI child // window. m_pView = (CTDGView *) pChild->GetActiveView(); m_pDOC = m_pView->GetDocument(); /////////////////////////////////////////////////////////// this code can be used from any part of the application to access a document. Hope this helps thanks Krithika