Click to See Complete Forum and Search --> : Doc-View Architechture


April 19th, 1999, 08:41 PM
I have an application (MDI) built over the document-view type of architecture of MFC. I have the following problems.
how ....
To get a pointer to an application object from document class?
To get a pointer to a frame window object from document class?

2. Regarding to CMDIChldWnd
To get a pointer to an application object from frame window class ?
To get a pointer to a document template object from frame window class?
To get a pointer to a document object from frame window class?GetActiveDocument()?
To get a pointer to a view object from frame window class? GetActiveView()?
3. Regarding to CView Class
To get a pointer to a document template object from CView class?
To get a pointer to an application object from CView class ?

Since I have two types of frameworks in my Application how can i access one from the other?
Waiting for a reply,
Thanks in advance
Tapan

Dave Lorde
April 20th, 1999, 04:27 AM
> To get a pointer to an application object from document class?

CWinApp* pApp = AfxGetApp();

To get a pointer to a frame window object from document class?

POSITION pos = GetFirstViewPosition();
CView* pView = GetNextView(pos);
CFrameWnd* pFrm = pView->GetParentFrame();

> To get a pointer to an application object from frame window class ?

CWinApp* pApp = AfxGetApp();

> To get a pointer to a document template object from frame window class?

CDocTemplate* pDocTemplate = GetActiveDocument()->GetDocTemplate();

> To get a pointer to a document object from frame window class?
> GetActiveDocument()?

Yes.

> To get a pointer to a view object from frame window class? GetActiveView()?

Yes.

> To get a pointer to a document template object from CView class?

CDocTemplate* pDocTemplate = GetDocument()->GetDocTemplate();

> To get a pointer to an application object from CView class ?

CWinApp* pApp = AfxGetApp();

Dave