BCGControlBar Pro for MFC
virtual CBCGPMDIChildWnd* CBCGPMDIFrameWnd::CreateDocumentWindow ( LPCTSTR  lpcszDocName,
CObject *  pObj 

Called by the framework during loading of the list of documents previously saved in the registry.

Override this method in order to properly create documents when they're being loaded from the registry.

A possible implementation may look like this:

// g_strStartViewName is a name of "virtual document" Start Page, it's not actually loaded from a disk file,
// therefore we need a special processing for this case.
CBCGPMDIChildWnd* CMainFrame::CreateDocumentWindow (LPCTSTR lpcszDocName, CObject* pObj)
if (lpcszDocName != NULL && lpcszDocName[0] != '\0')
CDocument* pDoc = NULL;
if (g_strStartViewName.Compare(lpcszDocName) == 0)
pDoc = theApp.m_pStartDocTemplate->OpenDocumentFile (NULL);
pDoc = AfxGetApp()->OpenDocumentFile(lpcszDocName);
if (pDoc != NULL)
POSITION pos = pDoc->GetFirstViewPosition();
if (pos != NULL)
CView* pView = pDoc->GetNextView(pos);
return DYNAMIC_DOWNCAST(CBCGPMDIChildWnd, pView->GetParent ());
return NULL;
lpcszDocNameA text string that contains a document identifier. Usually, it's a full path to a document file.
pObj[Optional] User-defined object which includes a document–specific data. Should have DECLARE_SERIAL/IMPLEMENT_SERIAL.