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 Tech Support » Crash in ProfileBarStateLoad Collapse All
Subject Author Date
Krustys Donuts Sep 20, 2007 - 4:14 PM

We load the application UI state (toolbar positions) with this code:

WINDOWPLACEMENT dataFrameWP;
CWinApp *app = AfxGetApp();
CExtControlBar::ProfileBarStateLoad( this, app->m_pszRegistryKey, app->m_pszProfileName, app->m_pszProfileName, &m_dataFrameWP);

This fatally crashes if there has been a change to the application which has added or removed toolbars or windows. Deleteing the registry keys fixes the crash. There does not appear to be a way to validate state before loading which might prevent this crash.

How do we validate state so that we can skip the load if it would otherwise cause a crash? A try / catch block around the ProfileBarStateLoad call does not prevent a crash.

Thanks in advance!

Suhai Gyorgy Sep 21, 2007 - 1:24 AM

From around version 2.51, there has been a new parameter added to ProfileBarStateLoad, called bEnableThrowExceptions. By default, this is false, but if you call ProfileBarStateLoad with bEnableThrowExceptions set to true, a try/catch block will prevent the crash. Same goes for CExtCmdManager::SerializeState.