Saving Quick Access Toolbar |
Post Reply |
Author | |
Dan
Groupie Joined: 11 June 2014 Status: Offline Points: 16 |
Post Options
Thanks(0)
Posted: 17 June 2014 at 6:51am |
Hi,
I'm trying to load/save user's custom changes to the Quick Access Toolbar using Toolkit Pro v16.3.1. I originally thought that something like this would work in the OnClose function ... CFile fSettings; if (fSettings.Open("c:\\setttings.xtb", CFile::modeCreate | CFile::modeWrite)) { CArchive ar(&fSettings, CArchive::store); CXTPPropExchangeArchive px(ar); CXTPRibbonQuickAccessControls *pQA = m_pRibbonBar->GetQuickAccessControls(); pQA->DoPropExchange(&px); // Causes ASSERT here ar.Close(); fSettings.Close(); } The CXTPRibbonQuickAccessControls class doesn't have its own DoPropExchange so this function is calling CXTPControls::DoPropExchange, and that seems to be expecting the m_dwData member of the CXTPPropExchange to be a pointer to a XTP_COMMANDBARS_PROPEXCHANGE_PARAM struct... void CXTPControls::DoPropExchange(CXTPPropExchange* pPX) { ASSERT(pPX->m_dwData != 0); XTP_COMMANDBARS_PROPEXCHANGE_PARAM* pParam = (XTP_COMMANDBARS_PROPEXCHANGE_PARAM*)pPX->m_dwData; ... } I'm not sure how I supposed to know that - so I suspect that I shouldn't be doing this. However, I continued and fixed the assert by adding these lines before the DoPropExchange call... XTP_COMMANDBARS_PROPEXCHANGE_PARAM param; param.bSaveOnlyCustomized = FALSE; param.bSaveOriginalControls = FALSE; param.bSerializeActions = FALSE; param.bSerializeControls = TRUE; param.bSerializeDesignerControls = FALSE; param.bSerializeImages = FALSE; param.bSerializeLayout = FALSE; param.bSerializeOptions = FALSE; px.m_dwData = (DWORD_PTR)¶m; That seemed to solve the problem - and indeed it appears that the quick access toolbar settings are saved to c:\\settings.xtb. Loading had similar issues ... the m_dwData had to be initialized to a pointer to the XTP_COMMANDBARS_PROPEXCHANGE_PARAM struct, and I had to set param.pCommandBars = GetCommandBars(). Saving & Loading then appears to be working - but is there a better way of accomplishing this? The Ribbon Bar sample applications included with Codejock 16.3.1 both have saving/loading routines commented out and enabling them either results in a crash, or the changes made to the Quick Access Toolbar not being saved and restored anyway. Any help would be appreciated. Thanks, Dan
|
|
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 |