![]() |
Saving dock state of CXTPCommandBars to registry |
Post Reply ![]() |
Author | |
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() Posted: 29 November 2006 at 8:27am |
Hello,
Upon your previous help (about saving the docking panes layout to the registry), we tried to do the same using the CXTPCommandBars.
Here is our code :
BOOL CMainFrame::LoadOrSaveCommandBarsLayout(BOOL bLoad, CXTPCommandBars* pCommandBars, CString sLayoutName)
{ if (pCommandBars) { ASSERT(!sLayoutName.IsEmpty()); HKEY hKey = GetRegistryLayoutKey();
ASSERT(hKey); if (hKey) { XTP_COMMANDBARS_PROPEXCHANGE_PARAM stParams; ::memset(&stParams, 0, sizeof(stParams)); stParams.bSerializeControls = FALSE; stParams.bSaveOnlyCustomized = FALSE; stParams.bLoadSilent = FALSE; stParams.bSaveOriginalControls = FALSE; stParams.bSerializeImages = FALSE; stParams.bSerializeOptions = FALSE; stParams.bSerializeLayout = TRUE; stParams.bSerializeDesignerControls = FALSE; stParams.bSerializeActions = FALSE; stParams.pCommandBars = pCommandBars; CXTPPropExchangeRegistry px(bLoad, hKey, sLayoutName);
pCommandBars->DoPropExchange(&px, &stParams); RegCloseKey(hKey); return TRUE;
} } return FALSE;
} The "hkey" is valid. But nothing is saved in the registry.
One more time, we hope that you will help us !
Regards,
|
|
Sergio
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Actually code looks good. Try to debug into DoPropExchange and check if
"if (pParam->bSerializeLayout)" block was exectuted.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
Hi, Ok, here are the results : -------------------------------------
This bloc is executed : Contents infos :
This bloc is executed : Contents infos : GetCount() = 3
This bloc is executed : Contents infos :
This bloc is executed : Contents infos :
Contents infos : for(...) :
... ------------------------------------- Does it helps ? |
|
Sergio
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
Again seems right.
so problem can be only in registry settings. May be hKey you get only "readonly"/may be sLayoutName contains symbols that can't be used as registry key ("\"."/". etc)
try again step into one of PX_,,,, and to CXTPPropExchangeRegistry::ExchangeProp and check what result of RegSetValueEx was.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
Hi, We set :
::RegCreateKeyEx(HKEY_CURRENT_USER, sKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKeyLayout, NULL);
sLayoutName = "AppMainFrame"
In the registry we now see :
Layout
DockBars
DockBar0
DockBar1
DockBar2
DockBar3
DockState
Each key is empty, there is just a "(default) REG_SZ (value not set)" per key.
Monday, we will step into your second answer.
|
|
Sergio
|
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
Hi, I stepped into the first PX_DWord(&secDockState, _T("Version"), m_dwVersion, 0).
This portion of code : void CXTPDockState::DoPropExchange(CXTPPropExchange* pPX) BOOL CXTPPropExchangeRegistry::ExchangeProp(LPCTSTR pszPropName, VARTYPE vtProp, void* pvProp, const void* pvDefault /*= NULL*/) { ... m_bUseDefaultOnSave = 1 ... case VT_BOOL: Perhaps the m_hSectionKey doesn't point to the correct registry key ? |
|
Sergio
|
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
There isn't any "ScreenSize" in the registry.
|
|
Sergio
|
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
( "ScreenSize" is easier to find than "Version" in the registry. )
|
|
Sergio
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Sergio, try to find some minutes to modify our sample and try reproduce the problem with same code. If sample will fail also, attach changed code here and we will quickly find reason.
It is impossible to say why without ability to debug/check what you do in code.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg,
Could you please give me the name of the sample to modify ?
Thanks,
|
|
Sergio
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Any from CommandBars folder. Just try to reroduce same problem. or can create new using Appwizard....
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |