# CodeGuru Technical FAQs > CodeGuru Individual FAQs >  MFC Doc/View: How to obtain a pointer to various objects?

## Andreas Masur

From this class:You can access this class using:CWinAppCMainFrameCChildFrameCDocumentCViewCWinApp AfxGetMainWnd() orm_pMainWndAfxGetMainWnd()->MDIGetActive()AfxGetMainWnd()->GetActiveView()->GetDocument()AfxGetMainWnd()->GetActiveView()CMainFrameAfxGetApp() ortheApp MDIGetActive() orGetActiveFrame()SDI: GetActiveView()->GetDocument()MDI: MDIGetActive()->GetActiveView()->GetDocument()SDI: GetActiveView()MDI: MDIGetActive()->GetActiveView()CChildFrameAfxGetApp() ortheAppGetParentFrame() GetActiveView()->GetDocument()GetActiveView()CDocumentAfxGetApp() ortheAppAfxGetMainWnd()AfxGetMainWnd()->MDIGetActive() POSITION pos =GetFirstViewPosition();GetNextView(pos);(see note below)CViewAfxGetApp() ortheAppAfxGetMainWnd()GetParentFrame()GetDocument() any other classAfxGetApp()AfxGetMainWnd()AfxGetMainWnd()->MDIGetActive() orAfxGetMainWnd()->GetActiveFrame()SDI: AfxGetMainWnd()->GetActiveView()->GetDocument()MDI: AfxGetMainWnd()->MDIGetActive()->GetActiveView()->GetDocument()SDI: AfxGetMainWnd()->GetActiveView()MDI: AfxGetMainWnd()->MDIGetActive()->GetActiveView()*Note:* To access only the current view, the document class can call AfxGetMainWnd()->GetActiveView() from a SDI application or AfxGetMainWnd()->MDIGetActive()->GetActiveView() from a MDI application.

----------

