Home > Software engineering >  Questions about dock pane GetDockState
Questions about dock pane GetDockState

Time:09-24

DockState. LoadState (theApp. M_pszRegistryKey);
SetDockState (DockState);
Registries have been successfully written status data, put in the ONCREATE (), SetDockState doesn't work, can not restore the original state, should put SetDockState in other events?

How will the other DockState. SaveState stored in INI?

CodePudding user response:

The App class ~
Virtual void LoadCustomState ();
Virtual void SaveCustomState ();

CodePudding user response:

//timing is feeling, but still can't be restore the original state of the
 
Void CRibbonApp: : LoadCustomState ()
{
PMainFrame - & gt; LoadState ();
}

Void CRibbonApp: : SaveCustomState ()
{
PMainFrame - & gt; 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);
}

CodePudding user response:

The inside of the App in the class InitInistance SetRegistryKey whether it is right to fill in?
To set breakpoints, carrying out to see if save/call; Step to follow up whether to read

CodePudding user response:

 DockState. LoadState (theApp. M_pszRegistryKey); 

TheApp. M_pszRegistryKey write parameters on this?

The following is that right?
//==============================================

CWinAppEx: : InitInstance ();


//initialize the OLE libraries
if (! AfxOleInit ())
{
AfxMessageBox (IDP_OLE_INIT_FAILED);
Return FALSE;
}

AfxEnableControlContainer ();

EnableTaskbarInteraction ();

//use the RichEdit control need AfxInitRichEdit2 ()
//AfxInitRichEdit2 ();

//initialize
//if you do not use these features and wish to reduce the
//the size of the final executable file, you should remove the following
//don't need the specific initialization routines
//change is used to store Settings registry keys
//TODO: should be appropriate to modify the string,
//such as modification for the company or organization name
//SetRegistryKey (_T (" application wizard to generate local application "));
BillApp SetRegistryKey (_T (" "));

CodePudding user response:

Judge each function call return value,

CodePudding user response:

CDockState: : LoadState
Void LoadState (LPCTSTR lpszProfileName);

The 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 the state information is stored.

Few

Call this function to retrieve the state information from the registry or the INI file. The profile name is the section of the application 's INI file or the registry that contains the bars' the state information, You can save the control bar state information to the registry or the INI file with SaveState.

CodePudding user response:

Just a rough look at the use DockState, need their binding window and state
Based on CMDIFrameWnd CDockingManager can use, the rough test if can

 
Int CMainFrame: : OnCreate (LPCREATESTRUCT LPCREATESTRUCT)
{
.
{
CDockingManager * pManage=GetDockingManager ();
PManage - & gt; LoadState (_T (" myTest. Ini "));
PManage - & gt; SetDockState ();
}
return 0;
}

//WM_CLOSE message response
Void CMainFrame: : OnClose ()
{
//TODO: add the message handler code and/or invoke the default
{
CDockingManager * pManage=GetDockingManager ();
PManage - & gt; SaveState (_T (" myTest. Ini "));
}

CMDIFrameWndEx: : OnClose ();
}

  • Related