BCGControlBar Pro for MFC
virtual BOOL CBCGPMDIFrameWnd::LoadMDIState ( LPCTSTR  lpszProfileName)

Loads the layout of MDI Tabbed Groups and the list of previously opened documents.

TRUE - load succeeded; FALSE - load failed or there is no data to load.

In order to load/save MDI tabs and groups state and the list of opened documents you need to do the following:

  • Call SaveMDIState() when the main frame is being closed
  • Call LoadMDIState when the main frame is being created. The recommended place for this call is before the main frame is displayed for the first time (see CBCGCBPVisualStudioGUIDemoApp::InitInstance()). Use CBCGPWorkspace::EnableLoadWindowPlacement (FALSE); before pMainFrame->LoadFrame (IDR_MAINFRAME); Use CBCGPWorkspace::ReloadWindowPlacement (pMainFrame) after LoadMDIState to display the main frame at position that was stored in the registry.
  • Override CBCGPMDIChildWnd::GetDocumentName in the CBCGPMDIChildWnd - derived class if your application displays documents that are not stored as files. The returned string will be saved in the registry as document identifier. The base implementation in CBCGPMDIChildWnd returns a value obtained from CDocument::GetPathName.
  • Override CreateDocumentWindow() in order to properly create documents when they're being loaded from the registry..
lpszProfileNameSpecifies the profile name.