Solved

Save placement of docking views for an ActiveX

Posted on 2003-12-02
8
252 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

705 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

19 Experts available now in Live!

Get 1:1 Help Now