• int CView::OnCreate(LPCREATESTRUCT lpcs)
    {
        if (CWnd::OnCreate(lpcs) == -1)
            return -1;

        // 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);
        }
        else
        {
            TRACE(traceAppMsg, 0, "Warning: Creating a pane with no CDocument.\n");
        }

        return 0;   // ok
    }