I have an application which has toolbars. The application already uses the system registry(Win95) and INI
files(Win32s) successfully. I wanted to save the user's positioning of the toolbars, and I was delighted to
find LoadBarState() and SaveBarState(), except THEY DON'T WORK.
THE PROBLEM:
LoadBarState() and SaveBarState() don't work. (They save info in the registry or INI file, but
sometimes it crashes on LoadBarState() and it always gets toolbars mixed up and placement wrong.
THE QUESTION:
Am I doing something wrong, forgetting to do something, or unable to use this for some reason? Does
anybody have any suggestions (Like not using these functions and writing my own)?
MORE DETAIL:
I have :
Standard ControlBar,
Standard StatusBar,
2 more CToolBars,
1 CMyDialogBar.
All I did to add "Toolbar State Saving" was to put LoadBarState() at the end of my MainFrame::OnCreate() and
SaveBarState() in MainFrame::OnClose().
Here is want is written in the INI and Registry (And I can't make sense of it:
[General-Summary]
Bars=8
ScreenCX=800
ScreenCY=600
[General-Bar0]
BarID=59392
Docking=1
MRUDockID=0
MRUDockLeftPos=-1
MRUDockTopPos=-1
MRUDockRightPos=629
MRUDockBottomPos=29
MRUFloatStyle=8192
MRUFloatXPos=-2147483648
MRUFloatYPos=-842150451
[General-Bar1]
BarID=59393
[General-Bar2]
BarID=59419
Bars=3
Bar#0=0
Bar#1=59392
Bar#2=0
[General-Bar3]
BarID=59421
Bars=6
Bar#0=0
Bar#1=59397
Bar#2=124934
Bar#3=0
Bar#4=59398
Bar#5=0
[General-Bar4]
BarID=59397
Docking=1
MRUDockID=0
MRUDockLeftPos=-1
MRUDockTopPos=-1
MRUDockRightPos=108
MRUDockBottomPos=207
MRUFloatStyle=4096
MRUFloatXPos=-2147483648
MRUFloatYPos=-842150451
[General-Bar5]
BarID=59398
MRUWidth=69
Docking=1
MRUDockID=0
MRUDockLeftPos=137
MRUDockTopPos=-1
MRUDockRightPos=168
MRUDockBottomPos=84
MRUFloatStyle=4096
MRUFloatXPos=435
MRUFloatYPos=465
[General-Bar6]
BarID=59398
XPos=107
Docking=1
MRUDockID=0
MRUDockLeftPos=107
MRUDockTopPos=-1
MRUDockRightPos=138
MRUDockBottomPos=84
MRUFloatStyle=4
MRUFloatXPos=-2147483648
MRUFloatYPos=-842150451
[General-Bar7]
BarID=59423
Horz=1
Floating=1
XPos=439
YPos=479
Bars=3
Bar#0=0
Bar#1=59398
Bar#2=0
--
Thank You,
/=========================================================\
|Devin Dow - de...@rsi-inc.com |
|Router Solutions, Inc. - Interface tools for CAE/CAD/CAM |
| __ _ http://www.rsi-inc.com |
| / \.\ EVIN Check Out CAMCAD for Windows |
| / /\ \.\ OW __ |
| \ \.\ \.\ o / o |\ \ |
| \ \/ /./ /\| /\|\ | \_\ |
| \ /./ / > < \ | \ GOAL!! |
| \/./ ' ` o ' ` | \ |
\=========================================================/
There is a problem with saving the tool bar states in MFC 4.0 and 4.1 (I
don't know if it's fixed
in 4.2). The first symptons that I saw was the size of the .INI file or
the registry entry growing
and growing. However after multiple save/loads, I did see problems
where the tool bars would no
longer be restored to the proper location. This can be seen with the
MFC sample, DOCKTOOL (the problem won't start until after a certain
sequence of tool bar moving -- I believe it was moving a
bar from one certain side to the top or bottom.)
I reported the problem to Microsoft and they came up with a fix which
has worked for me with
no problems so far. The fix is in the Knowledge Base (ID # 151446).
Here's the URL to take you directly to the article:
http://www.microsoft.com/kb/developr/visual_c/q151446.htm
Hope this helps!
Bill McGarry
Olivetti North America
bi...@mail.spk.olivetti.com