From anywhere inside your MFC app, you can call AfxGetMainWnd to get the main frame window. Next call the CFrameWnd methods GetActiveDocument or GetActiveView to get the doc or the view.