Article ID: 181255
Article Last Modified on 1/11/2006
APPLIES TO
- Microsoft ActiveX Template Library 2.1
- Microsoft ActiveX Template Library 3.0, when used with:
- Microsoft Visual C++ 5.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 5.0 Professional Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++ 6.0 Standard Edition
- Microsoft Visual C++ 2005 Express Edition
- Microsoft Visual C++ .NET 2003 Standard Edition
- Microsoft Visual C++ .NET 2002 Standard Edition
This article was previously published under Q181255
Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003
support both the managed code model that is provided by the Microsoft .NET
Framework and the unmanaged native Microsoft Windows code model. The
information in this article applies only to unmanaged Visual C++
code. Microsoft Visual C++ 2005 supports both the managed
code model that is provided by the Microsoft .NET Framework and the unmanaged native
Microsoft Windows code model.
SUMMARY
The Atlenum sample shows how to implement enumerated
properties in ATL.
MORE INFORMATION
The
following files are available for download from the Microsoft Download
Center:
Visual C++ 6.0
For more
information about how to download Microsoft support files, click the following
article number to view the article in the Microsoft Knowledge Base:
119591 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 prevent
any unauthorized changes to the file.
Visual C++ .NET
Release Date: June 25,
2002
For more information about how to download Microsoft support
files, click the following article number to view the article in the Microsoft
Knowledge Base:
119591 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 prevent
any unauthorized changes to the file.
Enumerated properties have a predefined set of possible
values that you can assign to them. For example, when you define an enumerated
property for the days of the week, the only possible values are Monday through
Sunday. You can control this by setting up an enumerated property in the .idl
file:
typedef enum tagDAYSOFWEEK
{
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
Sunday = 7
} DAYSOFWEEK;
Visual Basic 5.0 and later versions have a feature called Code
Completion. As you enter code, the editor displays a list of context-sensitive
items that you can use in your code. In the case of an enumerated property,
typing an "=" after the property causes Visual Basic to display a list of
possible values. For example, a list of possible values to complete the
following statement appears when you type:
mycontrol.DayOfWeek =
Enumerated properties also allow you to browse the possible
values for a property in a property browser. Look at the BorderStyle property
for any control in the Visual Basic property browser. Possible values are
displayed in a list box. By default, Visual Basic creates a list in the form of
"1 - Monday," "2 - Tuesday," and so on. If you want to the change the display
string, you need to override some methods in the IPerPropertyBrowsing
interface. The Atlenum sample shows how to override the GetDisplayString(),
GetPredefinedStrings(), and GetPredefinedValue() methods. The sample also
implements a property page for modifying the enumerated property.
Additional query words: Atlenum Atlenumvcnet
Keywords: kbhowto kbdownload kbserver kbfile kbsample kbctrl kbcollectionclass kbcode KB181255