I am using the MFC classes, but in a non-standard way (i.e. not using a CDocument derived class at all).
Be that as it may, I have several views derived from CFormView, and there are class member variables.
I have code that uses a derived class from CMiniFrameWnd and it is like so
CCreateContext context;
context.m_pNewViewClass = RUNTIME_CLASS(CImageView);
context.m_pCurrentDoc = NULL;
CView* pNewView = STATIC_DOWNCAST(CView, CreateView(&context));
if (pNewView != NULL)
{
pNewView->ShowWindow(SW_SHOW);
pNewView->OnInitialUpdate();
SetActiveView(pNewView);
}
// save view
But the snag with this is CreateView() is calling the default constructor of CImageView, and OnInitialUpdate() being a virtual override, must match CView()'s signature.
So how do I initialise member data belonging to CImageView? CreateView() and OnInitialUpdate() get in the way (unless I am missing something). It seems that derived classes from CView or CFormView are not easily initialised in the MFC architecture.
Thanks