-
September 28th, 2011, 01:01 PM
#1
Saving the layout of a CFrameWndEx app ?
If you examine the Registry entry for an application that uses a CMainFrame class derived from CFrameWndEx, you will find an entry entitled 'Workspace' which contains (I think) numerous entries releating to the last layout configuration.
I have seen applications that offer the user an option of 'Save Layout'. Is there a simple, direct way to do this ?
mpliam
-
September 28th, 2011, 03:31 PM
#2
Re: Saving the layout of a CFrameWndEx app ?
It depends how you define "save layout".
This is actually done by WinAppEx::LoadState called from CFrameImpl::OnLoadFrame. It reads various states from Workspace registry.
It is done without giving user any choice. If you want to use default implementation and give user a choice, override CFrameWndEx::LoadFrame.
You can also use LoadCustomState override to load custom states. This is called from WinAppEx::LoadState.
You can save custom state using SaveCustomState override called from CWinAppEx::OnClosingMainFrame, initiated from CFrameWndEx::OnClose
Both, LoadCustomState and SaveCustomState are inserted by the app wizard when application is created. They are empty, ready for inserting custom code.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 28th, 2011, 08:45 PM
#3
Re: Saving the layout of a CFrameWndEx app ?
Thanks John. My question was poorly thought out but your answer provided me with exactly what I was looking for. I really want a new user who installs the app on his machine to at first boot up a default layout. How best to do that ?
mpliam
-
September 29th, 2011, 07:30 AM
#4
Re: Saving the layout of a CFrameWndEx app ?
This should be quite easy. It is just a matter of saving layout you need to be used as default by running app, arranging layout and exit.
Get registry values for the workspace key (HKCU.Software.YourString.AppName.Workspace) and have installation program create this key.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 29th, 2011, 03:46 PM
#5
Re: Saving the layout of a CFrameWndEx app ?
Yeah. Thanks. I thought of that. But the Workspace registry entries for an app with a bunch of CDockablePane derived windows are alarmingly extensive. I was hoping that there was a easier way. Guess not.
One possible method would be to :
1 - Set up the app interface in the layout that you wish to be the default, then exit the app
2 - Using the Windows Registry Editor, highlight the 'Workspace' folder of the app in HKEY_CURRENT_USERS/... and Right Click->Export and save as Workspace.reg
3 - Presumably, an installer could use this *.reg file to initialize the default workspace configuration (not sure exactly how - depends upon the installer you're using).
What do you think ?
Last edited by Mike Pliam; September 30th, 2011 at 04:14 PM.
mpliam
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|