Article ID: 137354 - Last Review: August 5, 2004 - Revision: 3.2 Using Enumerated Properties in an OLE ControlThis article was previously published under Q137354 On This PageSUMMARY This is the Visual C++ 1.5x and 2.x version of this sample.
There is an equivalent Visual C++ 4.x 32-bit sample available under the name
ENPROP32. The Enumprop sample illustrates using enumerated properties in an OLE control. MORE INFORMATIONThe
following files are available for download from the Microsoft Download
Center: Enprop.exe (http://download.microsoft.com/download/vc15/samp53/1/win98/en-us/enprop.exe) For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591
(http://support.microsoft.com/kb/119591/EN-US/
)
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help to
prevent any unauthorized changes to the file.
After downloading Enprop.exe, run it in an empty directory using the -d switch (as follows) to automatically create subdirectories to hold the many files it contains: ENPROP.EXE -d An OLE control can limit a user's possible choices for a property by presenting a drop list combo box that lists the possibilities on its property page. However, another mechanism is needed to enable a property browser provided by another application to be able to provide the same type of interface when editing the property. There are two ways to implement an enumerated property so that a property browser can gather enough information about the property to provide the right editing interface. One method involves declaring an enum type in the OLE control's .odl file and manually editing the property's declaration to make it be of that type. For example: The ENUMPROP sample illustrates using both methods. The OLE control implemented in the sample supports two custom properties, LineStyle and FillPattern. The LineStyle property is declared as an enum in the control's .odl file. Support for using the FillPattern property as an enumerated property is handled by using overrides of the OnGetPredefinedStrings, OnGetPredefinedValue, and OnGetDisplayString methods. ENUMPROP is based on a ControlWizard-generated OLE control. Files included with the sample, which are directly related to using enumerated properties, are: Enum.odl - Shows declaring the enum type for the LineStyle property. Enumctl.cpp - Illustrates overriding the COleControl members OnGetPredefinedStrings, OnGetPredefinedValue, and OnGetDisplayString. warning
M0002: Warning near line 35 column 35: specified type is not supported by
IDispatch::Invoke NOTE: The test container tool provided with the CDK does not implement a drop list combo box on its property browser page when editing an enumerated property. To see the full benefits of using an enumerated property, use an OLE control container application that provides a property browser with this capability. RFERENCESFor more information, please see the Per-Property Browsing section in Appendix D, OLE Controls Architecture, in the CDK Books Online.APPLIES TO
| Article Translations
|

Back to the top
