Typedef, Enum, Union, and Struct Attributes

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

The following attributes apply to the typedef, struct, and enum C++ keywords.

typedef

AttributeDescription
caseUsed with the switch_type attribute in a union.
customLets you define your own attribute.
exportCauses a data structure to be placed in the .idl file.
first_isSpecifies the index of the first array element to be transmitted.
helpcontextSpecifies a context ID that lets the user view information about this element in the Help file.
helpfileSets the name of the Help file for a type library.
helpstringSpecifies a character string that is used to describe the element to which it applies.
library_blockPlaces a construct inside the .idl file's library block.
ptrDesignates a pointer as a full pointer.
publicEnsures that a typedef will go into the type library even if it is not referenced from within the .idl file.
refIdentifies a reference pointer.
switch_isSpecifies the expression or identifier acting as the union discriminant that selects the union member.
switch_typeIdentifies the type of the variable used as the union discriminant.
uniqueSpecifies a unique pointer.
wire_marshalSpecifies a data type that will be used for transmission instead of an application-specific data type.

enum

AttributeDescription
customLets you define your own attribute.
exportCauses a data structure to be placed in the .idl file.
uuidSpecifies the unique ID for a class or interface.
v1_enumDirects that the specified enumerated type be transmitted as a 32-bit entity, rather than the 16-bit default.

union

AttributeDescription
customLets you define your own attribute.
exportCauses a data structure to be placed in the .idl file.
first_isSpecifies the index of the first array element to be transmitted.
last_isSpecifies the index of the last array element to be transmitted.
length_isSpecifies the number of array elements to be transmitted.
max_isDesignates the maximum value for a valid array index.
size_isSpecifies the size of memory allocated for sized pointers, sized pointers to sized pointers, and single- or multidimensional arrays.
uniqueSpecifies a unique pointer.
uuidSpecifies the unique ID for a class or interface.

Nonencapsulated union

AttributeDescription
ms_unionControls the network data representation alignment of nonencapsulated unions.
no_injected_textPrevents the compiler from injecting code as a result of attribute use.

struct

AttributeDescription
aggregatableIndicates that the class supports aggregation.
aggregatesIndicates that a control aggregates the target class.
appobjectIdentifies the coclass as an application object, which is associated with a full .exe application, and indicates that the functions and properties of the coclass are globally available in this type library.
coclassCreates an ActiveX control.
com_interface_entryAdds an interface entry to a COM map.
controlSpecifies that the user-defined type is a control.
customLets you define your own attribute.
db_columnBinds a specified column to the rowset.
db_commandCreates an OLE DB command.
db_paramAssociates the specified member variable with an input or output parameter and delimits the variable.
db_sourceCreates a connection to a data source.
db_tableOpens an OLE DB table.
defaultIndicates that the custom or dispinterface defined within a coclass represents the default programmability interface.
defaultvtableDefines an interface as the default vtable interface for a control.
event_receiverCreates an event receiver.
event_sourceCreates an event source.
exportCauses a data structure to be placed in the .idl file.
first_isSpecifies the index of the first array element to be transmitted.
hiddenIndicates that the item exists but should not be displayed in a user-oriented browser.
implements_categorySpecifies implemented component categories for the class.
last_isSpecifies the index of the last array element to be transmitted.
length_isSpecifies the number of array elements to be transmitted.
max_isDesignates the maximum value for a valid array index.
requires_categorySpecifies the required component categories of the target class.
size_isSpecifies the size of memory allocated for sized pointers, sized pointers to sized pointers, and single- or multidimensional arrays.
sourceOn a class, specifies the COM object's source interfaces for connection points. On a property or method, indicates that the member returns an object or VARIANT that is a source of events.
threadingSpecifies the threading model for a COM object.
uniqueSpecifies a unique pointer.
uuidSpecifies the unique ID for a class or interface.
versionIdentifies a particular version among multiple versions of a class.
vi_progidSpecifies a version-independent form of the ProgID.

Attributes by Usage

Show: