共用方式為


CMDIFrameWndEx::LoadMDIState

載入 MDI 索引標籤的群組和先前開啟的文件清單中所指定的設定。

virtual BOOL LoadMDIState(
   LPCTSTR lpszProfileName 
);

參數

  • [in] lpszProfileName
    指定設定檔名稱。

傳回值

TRUE ,如果載入成功, FALSE ,如果載入失敗或沒有載入的資料。

備註

若要載入或儲存 MDI 索引標籤狀態和群組和開啟的檔案清單,請執行下列步驟:

  • 主要畫面格,在關閉時,請呼叫 CMDIFrameWndEx::SaveMDIState

  • 在中,主要畫面格建立時,請呼叫 CMDIFrameWndEx::LoadMDIState 。 這個呼叫的建議位置是,在主框架第一次顯示。 將 CWinAppEx::EnableLoadWindowPlacement(FALSE); ,在 pMainFrame-_>LoadFrame (IDR_MAINFRAME);. 加入 CBCGPWorkspace::ReloadWindowPlacement(pMainFrame); ,在這個呼叫 LoadMDIState 顯示主要畫面格 (例如) 會在登錄中儲存的位置後。

  • 請覆寫 CMDIChildWndExGetDocumentName 衍生類別,如果您的應用程式會顯示不會儲存為檔案的資料。 傳回的字串在登錄中儲存為文件識別項。 CMDIChildWndEx::GetDocumentName 的基底實作會從 CDocument::GetPathName取得的值。

  • 覆寫正確建立文件的 CMDIFrameWndEx::CreateDocumentWindow ,以便從登錄載入。 第一個參數是 GetDocumentName 傳回的字串。

範例

下列範例示範如何使用 LoadMDIStateVisualStudioDemo 範例:MFC Visual Studio 應用程式

    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);

    if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
    {
        if (!pMainFrame->LoadMDIState(GetRegSectionPath()))
        {
            m_pStartDocTemplate->OpenDocumentFile(NULL);
        }
    }
    else
    {
        // Dispatch commands specified on the command line 
        if (!ProcessShellCommand(cmdInfo))
            return FALSE;
    }

需求

標題: afxMDIFrameWndEx.h

請參閱

參考

CMDIFrameWndEx 類別

階層架構圖表