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

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

Returns
TRUE - save succeeded; FALSE - save failed.

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 CCBCGCBPVisualStudioGUIDemoApp::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. lpcszDocName - is the string that was previously returned from.
Parameters
lpszProfileNameSpecifies the profile name.