Implementing Persistent Properties for OLE Controls

Last reviewed: October 12, 1995
Article ID: Q124176
The information in this article applies to:
  • Microsoft OLE Control Developer's Kit (CDK), version 1.0

SUMMARY

The OLE Control Developer's Kit (CDK) "Programmer's Reference" documents four methods for creating custom properties:

  • Member Variable
  • Member Variable with Notification
  • Get/Set Methods
  • Parameterized

To implement a persistent property, use one of the last three methods.

MORE INFORMATION

When modifying a persistent property, call the COleControl::SetModifiedFlag function to indicate that the control's persistent state has changed and needs to be saved.

The following three methods for implementing custom properties provide a function from which you can call SetModifiedFlag():

  • Member Variable with Notification
  • Get/Set Methods
  • Parameterized

If you use ClassWizard to generate the code for your properties, ClassWizard will place a call to SetModifiedFlag() in the:
  • On<property>Changed function generated when you use the Member Variable with Notification method.

    -or-

  • Set<property> function generated when you use the Get/Set Methods or Parameterized method.

When you use the remaining method (Member Variable), a member variable in your control corresponding to the property is modified directly. Your control is not notified that its persistent state has been modified.

NOTE: The OLE CDK Tutorial, Chapter 5, discusses implementing a custom persistent property (FlashColor) to the CIRC Ole Control by using the Member Variable method. This discussion is designed solely to demonstrate how to use the Member Variable method to implement a custom property. The technique should not be used for persistent properties.


Additional reference words: kbinf 1.00
KBCategory: kbole kbprg
KBSubCategory: CDKIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 12, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.