Solved

Save placement of docking views for an ActiveX

Posted on 2003-12-02
8
253 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now