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 » Re: Saving parameters Collapse All
Subject Author Date
Adelin Nov 26, 2002 - 12:45 PM

Hi Sergiy,

If I understand it right, it is not possible to save or read other settings than those of Windowpositions and toolbars directly with the library.

What I want to do is save and read settings from and to DLGboxes and PropertySheets in a way as easy as yours :

VERIFY(CExtControlBar::ProfileBarStateSave(this, pApp->m_pszRegistryKey,
pApp->m_pszProfileName,    pApp->m_pszProfileName,&m_dataFrameWP));
VERIFY(g_CmdManager->SerializeState(pApp->m_pszProfileName, pApp->m_pszRegistryKey,pApp->m_pszProfileName, true));

In 2 or 3 lines of code, and this in the registry or in a file.

If possible, code such an example
Many thanks and regards
Adelin

Sergiy Lavrynenko Nov 27, 2002 - 9:55 AM

Dear Adelin,

The command manager state and control bar state serializations are based on the binary archive stream because internal data of these objects are thousand times more complex than a single WINDOWPLACEMENT data structure of a single dialog or property sheet window. These complex states are stored in the windows registry as sub-tree structure which contains data from CArchive object based on CMemFile object (plus integrity check value and format version value).

Window position of the dialog or property sheet is stored in the windows registry as one string variable with comma separated numbers which are values from the WINDOWPLACEMENT data structure. This technique allows to load/save dialog position separately from any other data. Dialog loads and saves its state automatically with each modal or non-modal execution (for instance, inside a CDialog::DoModal() call).

It is possible to write initialization/shutdown code which will use the one CArchive object for:

- command manager state serialization
- control bar state serialization
- serialization of any CObject derived instances
- serialization of any other data like WINDOWPLACEMENT structures

These CArchive can be based on data in the windows registry subtree. It can be based on the file. But there is no reason to do this. You will need to read big CArchive data from the registry or file each time when you need just a small WINDOWPLACEMENT data structure for one dialog. In other case you will need to keep in memory named WINDOWPLACEMENT collection for several dialogs.

Do you need the source code for this idea?

Best regards,
Sergiy Lavrynenko