pswann
asked on
ATL Control and Persistence
I created a control using the ATL wizards in VC++ 6. I added a 'Full Control' into the ATL project (derived from a Combo Box) and a 'Property Page' object.
I added several check boxes onto the property page, then tied them to the control using PROP_ENTRY and the IDL ID. When I use my new control in Test Container, the property page works fine. It remembers it's settings and implements the changes correctly.
However, when I try to insert my control into a test MFC applet, the property page does not work as expected. When I bring up the properties, the page is initialised correctly. Setting options and closing the properties dialog, then bringing it up again seems to remember the settings I chose, but the moment I save the resource, the changes are lost.
Do I have to implement persistence for my property page/control (Save/Load/InitNew methods) and if so, how do I go about doing this - MSDN seems very contradictory in this area.
Thanks,
Mark.
I added several check boxes onto the property page, then tied them to the control using PROP_ENTRY and the IDL ID. When I use my new control in Test Container, the property page works fine. It remembers it's settings and implements the changes correctly.
However, when I try to insert my control into a test MFC applet, the property page does not work as expected. When I bring up the properties, the page is initialised correctly. Setting options and closing the properties dialog, then bringing it up again seems to remember the settings I chose, but the moment I save the resource, the changes are lost.
Do I have to implement persistence for my property page/control (Save/Load/InitNew methods) and if so, how do I go about doing this - MSDN seems very contradictory in this area.
Thanks,
Mark.
There is an article on www.codeguru.com under ATL & COM. Its titled "ActiveX Control Tutuorial". It explains the persistence and has implemented all possible persistence types for an control. It should give you an a idea,
ASKER
We have had a look at the web sites indicated above but they did not provide any information as to why our information is not be serialised correctly within the resource.
The properties we are attempting so save are all integer properties. (we have 5 separate checkboxes on a property page). We are using the Prop_Entry() macro and we believe this should be sufficient to serialise these properties ?
The properties we are attempting so save are all integer properties. (we have 5 separate checkboxes on a property page). We are using the Prop_Entry() macro and we believe this should be sufficient to serialise these properties ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thuis answer was probably better but thanks for the advice
ATL only supports integer properties for persistence. If you have any other data types (objects or strings, or anything else), you will need to write the code yourself.
I would recommend you go to http://www.wrox.com and download the code for Beginning ATL COM Programming and take a look at the code for chapter 8. Another resource is at the same web site, but download Professional ATL COM Programming and look at the code for Chapter 10. Both of these books are excellent for ATL programming.