Print Page | Close Window

How to save the layout to a specific reg. location

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=5628
Printed Date: 04 October 2024 at 5:21pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to save the layout to a specific reg. location
Posted By: Sergio
Subject: How to save the layout to a specific reg. location
Date Posted: 28 November 2006 at 12:56pm
Hello,
 
Do you know how we could save the docking pane layout to a specific registry key ? (Codejock V.10.3.1, MFC)
 
(   CXTPDockingPaneLayout* pPaneLayout;   )
pPaneLayout->Save(_T("HKEY_CURRENT_USER\\Software\\Company\\SpecificApp\\LayoutBars\\MainFrameLayout"));
 
We really need to store it at a specific location, because we have many softwares using the same core...
 
Please help !
Regards,
 


-------------
Sergio



Replies:
Posted By: Oleg
Date Posted: 28 November 2006 at 1:15pm

Hello,

See in Help CXTPPropExchangeRegistry class and CXTPDockingPaneLayout::DoPropExchange


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Sergio
Date Posted: 29 November 2006 at 4:53am
Hello,
 
I understood what to do. For your information, here's my final code :
 
 
HKEY CMainFrame::GetRegistryLayoutKey()
{
     CString sKeyName;
     sKeyName.Format(_T("Software\\CompanyName\\%s"), GetSpecificApplicationName());
     HKEY hKeyLayout = NULL;
     ::RegCreateKeyEx(HKEY_CURRENT_USER, sKeyName, 0, NULL, REG_OPTION_NON_VOLATILE,
          KEY_ALL_ACCESS, NULL, &hKeyLayout, NULL);
     return hKeyLayout;
}
 
BOOL CMainFrame::LoadOrSaveLayout(BOOL bLoad, CXTPDockingPaneManager* pPaneManager, CXTPDockingPaneLayout* pPaneLayout, CString sLayoutName)
{
     if (pPaneManager && pPaneLayout)
     {
          ASSERT(!sLayoutName.IsEmpty());
          HKEY hKey = GetRegistryLayoutKey();
          ASSERT(hKey);
          if (hKey)
          {
               if (!bLoad)
                    pPaneManager->GetLayout(pPaneLayout);
               CXTPPropExchangeRegistry px(bLoad, hKey, sLayoutName);
               pPaneLayout->DoPropExchange(&px);
               RegCloseKey(hKey);
               if (bLoad)
                    pPaneManager->SetLayout(pPaneLayout);
               return TRUE;
          }
     }
     return FALSE;
}
 
Thanks a lot !
Best Regards,


-------------
Sergio


Posted By: Oleg
Date Posted: 29 November 2006 at 6:21am

Thanks you for sharing. All look right.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net