DockState.LoadState(theApp.m_pszRegistryKey);
SetDockState(DockState);
注冊表里已成功寫入狀態資料,放在ONCREATE()里,SetDockState不起作用,不能恢復原狀態,是否應放SETDOCKSTATE在其它事件里?
另怎樣將DockState.SaveState存入INI?
uj5u.com熱心網友回復:
App類中~virtual void LoadCustomState();
virtual void SaveCustomState();
uj5u.com熱心網友回復:
//時序是感覺可以,但仍不能恢復原來的狀態
void CRibbonApp::LoadCustomState()
{
pMainFrame->LoadState();
}
void CRibbonApp::SaveCustomState()
{
pMainFrame->SaveState();;
}
//==============================================
void CMainFrame::LoadState()
{
MessageBox(_T("Load Steate"));
DockState.LoadState(theApp.m_pszRegistryKey);
SetDockState(DockState);
}
void CMainFrame::SaveState()
{
MessageBox(_T("Save Steate"));
GetDockState(DockState);
DockState.SaveState(theApp.m_pszRegistryKey);
}
uj5u.com熱心網友回復:
App類中的InitInistance里面的 SetRegistryKey 是否正確填寫?設定斷點,看看保存/呼叫是否執行到; 單步跟進 看寫入讀出是否一致
uj5u.com熱心網友回復:
DockState.LoadState(theApp.m_pszRegistryKey);
theApp.m_pszRegistryKey 這樣寫引數對嗎?
以下這樣對嗎?
//==============================================
CWinAppEx::InitInstance();
// 初始化 OLE 庫
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction();
// 使用 RichEdit 控制元件需要 AfxInitRichEdit2()
// AfxInitRichEdit2();
// 標準初始化
// 如果未使用這些功能并希望減小
// 最終可執行檔案的大小,則應移除下列
// 不需要的特定初始化例程
// 更改用于存盤設定的注冊表項
// TODO: 應適當修改該字串,
// 例如修改為公司或組織名
//SetRegistryKey(_T("應用程式向導生成的本地應用程式"));
SetRegistryKey(_T("BillApp"));
uj5u.com熱心網友回復:
判斷每個函式呼叫的回傳值。uj5u.com熱心網友回復:
CDockState::LoadStatevoid LoadState( LPCTSTR lpszProfileName );
Parameters
lpszProfileName
Points to a null-teminated string that specifies the name of a section in the initialization file or a key in the Windows registry where state information is stored.
Remarks
Call this function to retrieve state information from the registry or .INI file. The profile name is the section of the application's .INI file or the registry that contains the bars' state information. You can save control bar state information to the registry or .INI file with SaveState.
uj5u.com熱心網友回復:
剛粗略的看了一下 使用 DockState 的話,需要自己系結視窗及狀態基于 CMDIFrameWnd 的,有 CDockingManager 可以使用, 粗試了一下好像可以
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
……
{
CDockingManager *pManage = GetDockingManager();
pManage->LoadState(_T("myTest.ini"));
pManage->SetDockState();
}
return 0;
}
//WM_CLOSE訊息回應
void CMainFrame::OnClose()
{
// TODO: 在此添加訊息處理程式代碼和/或呼叫默認值
{
CDockingManager *pManage = GetDockingManager();
pManage->SaveState(_T("myTest.ini"));
}
CMDIFrameWndEx::OnClose();
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/73812.html
標籤:界面
下一篇:懂串口的大神進來~~~~
