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
Solved

Save placement of docking views for an ActiveX

Posted on 2003-12-02
8
257 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Move constructor only called if marked noexcept? 6 108
C++ to C# code conversion issue 4 112
c++, dynamic object by json 1 53
designing in object programming 12 94
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…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

840 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