Solved

Save placement of docking views for an ActiveX

Posted on 2003-12-02
8
259 Views
Last Modified: 2012-05-04
Hi,

I created an ActiveX that has dockable views.

All works fine, but I want to store the placement of the docking views to find back placement each time I the ActiveX is loaded.

An application can have 2 instances of my activeX but set placement of views differently on each control.
And so I must save the placement for each instance of the control.

The docking views are the Cristi Posea CSizingControlBar library.

Any idea?

I saw that in a common application the docking views placement are stored using the AfxGetApp() profile section, but this does not suit my need.

Thanks a lot!
0
Comment
Question by:FMayis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 9859507
>>Any idea?

Yes. Save them in the registry where the profile section is stored under subkeys that reflect which controls' settings they are. This is the way it is usually done and will suit your needs with a little tweaking :o)
0
 

Author Comment

by:FMayis
ID: 9859620
OK,

where exactly in the registries?
    - Under the application registry
    - Under the classid of the control registry
    ...

Thanks
0
 
LVL 86

Expert Comment

by:jkr
ID: 9859668
I'd save it under

HKEY_CURRENT_USER\MyCompany\MyApp\x.y\ViewSettings\Control1
HKEY_CURRENT_USER\MyCompany\MyApp\x.y\ViewSettings\Control2

Of course you are free to give the keys a more meaningful name and/or leave out the version numbers :o)

The essential part is to save that setting on a per-user basis, as it is quite annoying to have two people with two differenent preferences share the same settings.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:FMayis
ID: 9859947
Something I don't understand very well.

Just to be sure we are OK
I save the settings of the ActiveX and from the ActiveX, not from the application.
The application does nothing but open/close, and the ActiveX load/save itself the settings of the views.

So from this, I am OK with your solution but how do you know, when you are in the code of the ActiveX, that you are in the code of Control1 or Control2.

0
 
LVL 86

Expert Comment

by:jkr
ID: 9859990
>>I save the settings of the ActiveX and from the ActiveX, not from the application

Well, then this is just a naming problem - do you want these settings to be associated (logically) with the application or the control? You are of course also free to choose

HKEY_CURRENT_USER\MyCompany\MyControl\x.y\ViewSettings\Control1

as the key to save your settings under.
0
 
LVL 86

Expert Comment

by:jkr
ID: 9860546
BTW, if you need another (MFC) sample on how to show a menu, take a lok at http://www.codeguru.com/shell/systemtray.shtml
0
 

Author Comment

by:FMayis
ID: 9860690
Thanks I already got it.

I have found a solution for my problem.

I explain:
 What I really need was not to rewrite the CDockState class to store the dockable view settings, there are some MRU and BarID stuff that I don't understand and that I don't want to understand.

 So I have done the following:
    - Use a persistent property of the ActiveX let's say IDString.
    - Each time an ActiveX is created I look at its IDString property, if it is empty, I set IDString to a GUID.
    - Now to store the views placement of the ActiveX control I use the Serialize function of the CDockState class.
    - The name of the file for the archive pass to Serialize is dependant of the IDString of the control. And all the files are kept in the path of the ActiveX.

So each instance of the ActiveX created will have its own settings for the views.

You have got the points Bye!!
0
 
LVL 86

Expert Comment

by:jkr
ID: 9860708
You're welcome :o)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question