Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtCustomizePageKeyboard: How to serialize shortcuts in a file (not in registry)? Collapse All
Subject Author Date
Oliver Rau Apr 15, 2009 - 9:27 AM

Dear ProfUIS-Team,



what would be the right way to serialize keyboard shortcuts that have been defined or modified through CExtCustomizePageKeyboard not in the registry but in a file?



Kind regards,



Martin

Technical Support Apr 16, 2009 - 1:55 PM

The keyboard shortcuts are serialized as part of the customization subsystem state. The CExtCustomizeSite::CustomizeStateSerialize() method allows you to serialize the state of the customization subsystem into the CArchive stream which can be based on the CFile object opened on the file system’s file.
If you need to serialize keyboard accelerators only, the following code does this for all the registered documents/menus:

CArchive & ar = . . .
CExtCustomizeSize * pSite = . . .
INT i, nMenuInfoCount = pSite->MenuInfoGetCount();
            for(i = 0; i < nMenuInfoCount; i++ )
            {
                        CExtCustomizeSize::CCmdMenuInfo * pCmdMenuInfo = pSite->MenuInfoGetAt( i );
                        ASSERT( pCmdMenuInfo != NULL );
                        pCmdMenuInfo->AccelTableSerialize( ar );
            }
You can serialize the keyboard accelerators of one menu line only by invoking its CExtCustomizeSite::CCmdMenuInfo::AccelTableSerialize() method. You should invoke the CExtCustomizeSite::OnUpdateAccelGlobalInfo() method after loading keyboard accelerators.