Implementing Persistent Properties for OLE Controls (124176)



The information in this article applies to:

  • Microsoft OLE Control Developer's Kit (CDK)

This article was previously published under Q124176

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.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB124176