void CMainFrame::LoadQuickAccessControls()
{
CXTPRibbonBar* pRibbonBar = DYNAMIC_DOWNCAST(CXTPRibbonBar,
GetCommandBars()->GetMenuBar());
if (pRibbonBar == NULL) return;
CXTPRibbonQuickAccessControls *pQA = pRibbonBar->GetQuickAccessControls();
if (pQA == NULL) return;
XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;
param.pCommandBars = GetCommandBars();
param.bSaveOnlyCustomized = FALSE;
param.bLoadSilent = TRUE;
param.bSaveOriginalControls = TRUE;
param.bSerializeActions = TRUE;
param.bSerializeControls = TRUE;
param.bSerializeDesignerControls = TRUE;
param.bSerializeImages = FALSE;
param.bSerializeLayout = TRUE;
param.bSerializeOptions = TRUE;
HKEY hKey = NULL;
if (::RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Codejock Software Sample Applications
\\Codejock Ribbon MDI Sample"), 0, KEY_READ, &hKey) != ERROR_SUCCESS)
{
pRibbonBar->GetQuickAccessControls()->Reset();
return;
}
::RegCloseKey(hKey);
if (::RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Codejock Software Sample Applications
\\Codejock Ribbon MDI Sample"), 0, KEY_READ, &hKey) != ERROR_SUCCESS)
return;
pRibbonBar->GetQuickAccessControls()->RemoveAll();
CXTPPropExchangeRegistry px(TRUE, hKey, _T("QuickAccessLayout"));
px.m_dwData = DWORD_PTR(¶m);
pQA->DoPropExchange(&px);
::RegCloseKey(hKey);
}
void CMainFrame::SaveQuickAccessControls()
{
CXTPRibbonBar* pRibbonBar = DYNAMIC_DOWNCAST(CXTPRibbonBar,
GetCommandBars()->GetMenuBar());
if (pRibbonBar == NULL) return;
CXTPRibbonQuickAccessControls *pQA = pRibbonBar->GetQuickAccessControls();
if (pQA == NULL) return;
XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;
param.pCommandBars = NULL;// GetCommandBars();
param.bSaveOnlyCustomized = FALSE;
param.bLoadSilent = TRUE;
param.bSaveOriginalControls = FALSE;
param.bSerializeActions = TRUE;
param.bSerializeControls = TRUE;
param.bSerializeDesignerControls = TRUE;
param.bSerializeImages = FALSE;
param.bSerializeLayout = TRUE;
param.bSerializeOptions = TRUE;
HKEY hKey = NULL;
if (::RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Codejock Software Sample Applications
\\Codejock Ribbon MDI Sample"), 0, KEY_WRITE, &hKey) != ERROR_SUCCESS)
return;
CXTPPropExchangeRegistry px(FALSE, hKey, _T("QuickAccessLayout"));
px.m_dwData = DWORD_PTR(¶m);
pQA->DoPropExchange(&px);
::RegCloseKey(hKey);
}