In function BOOL CreateView (int row, int col, CRuntimeClass * pViewClass, SIZE sizeInit, CCreateContext * pContext); in a parameter CCreateContext * pContext, which has the current pointer in the document in OnCreate CView: // if ok Wire in the current document assert (m_pdocument == null); ccreatecontext * pContext = (ccreatecontext *) lpcs-> lpcreateParams;
// A view should be created in a given context if (pContext = NULL && pContext-> m_pCurrentDoc = NULL!!) {PContext-> m_pCurrentDoc-> AddView (this); ASSERT (m_pDocument = NULL!);}! Is, Calls AddView here. OK, That's it.