   CView Problem
  1.How do I get View in CMainFrm?2.How to close the view Normally?   
  Question 1:If you are wanting to get an object for the view class from within the CMainFrame class, first you must:#include "MyApp Doc.h"#include "MyApp View.h"Then, when you want to get an object to the class:CMyAppView *pView = (CMyAppView*) GetActiveView();pView->DoWhatever();If you are wanting a view object from another class:#include "MainFrm.h"#include "MyApp Doc.h"#include "MyApp View.h"// In some function ...CMainFrame *pFrame = (CMainFrame*) AfxGetMainWnd();CMyAppView *pView  = (CMyAppView*) pFrame->GetActiveView();pView->DoWhatever();As for question 2, I don't think I'm sure how to do what you've asked. But what do you mean "close the view normally"?Hope this helps! =)   ;  Thank you for your help,butWhat I want is How to get all Views not just the active View."Close the View Normally" means that the Frame will bring up the message box(Save or not)   ;  1) You can get your CView objects per document. You get the active document and then enumerate all the views it currently has:CDocument* pDoc = MainFrm->GetActiveDocument();POSITION pos = pDoc->GetFirstViewPosition();while (pos != NULL) {   CView* pView = pDoc->GetNextView(pos);   // do whatever you want with the view}2) Closing a view normally doesn't show the dialog; this is handled by the document. If something changes in the document you should set the dirty flag with SetModifiedFlag function. Then whenever the document is closed, it will automatically popup the message box.I hope this helps :)   