Solved

Save placement of docking views for an ActiveX

Posted on 2003-12-02
8
256 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting IP address 8 79
Best book to learn C++ 4 79
Dialogbox API leak? 18 95
Eclipse IDE - Cannot copy/paste from console output 8 190
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

773 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