Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - How to save the layout to a specific reg. location
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to save the layout to a specific reg. location

 Post Reply Post Reply
Author
Message
Sergio View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 September 2006
Status: Offline
Points: 216
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sergio Quote  Post ReplyReply Direct Link To This Post Topic: How to save the layout to a specific reg. location
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 28 November 2006 at 1:15pm

Hello,

See in Help CXTPPropExchangeRegistry class and CXTPDockingPaneLayout::DoPropExchange
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Sergio View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 September 2006
Status: Offline
Points: 216
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sergio Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2006 at 6:21am

Thanks you for sharing. All look right.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.