IDL Attributes
Traditionally, maintaining an .idl file meant that you had to:
Be familiar with the structure and syntax of an .idl file to be able to modify it.
Rely on a wizard, which would let you modify some aspects of the .idl file.
Now, you can modify the .idl file from within a source code file using Visual C++ IDL attributes. In many cases, Visual C++ IDL attributes have the same name as MIDL attributes. When the name of a Visual C++ IDL attribute and a MIDL attribute are the same, it means that putting the Visual C++ attribute in your source code file will result in an .idl file that contains its namesake MIDL attribute. However, a Visual C++ IDL attribute may not provide all the functionality of a MIDL attribute.
When not used with COM attributes, IDL attributes let you define interfaces. When the source code is compiled, the attributes are used to define the generated .idl file. When used with COM attributes in an ATL project, some IDL attributes, such as coclass, cause code to be injected into the project.
Note that idl_quote lets you use MIDL constructs that are not supported in the current version of Visual C++. This and other attributes such as importlib and includelib help you to use existing .idl files in your current Visual C++ project.
Attribute |
Description |
---|---|
Indicates that a control can be aggregated by another control. |
|
Identifies 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. |
|
Specifies the UUID that directs the MIDL compiler to define both synchronous and asynchronous versions of a COM interface. |
|
Indicates that the property supports data binding. |
|
Enables a nonremotable function to be mapped to a remote function. |
|
Used with the switch_type attribute in a union. |
|
Places class definition into an .idl file as coclass. |
|
Specifies that the user-defined type is a control. |
|
Emits the specified string, without the quote characters, into the generated header file. |
|
Indicates the single, bindable property that best represents the object. |
|
Used for Visual Basic code optimization. |
|
Allows specification of a default value for a typed optional parameter. |
|
Indicates that the custom or dispinterface defined within a coclass represents the default programmability interface. |
|
Defines an interface as the default vtable interface for a control. |
|
Places an interface in the .idl file as a dispatch interface. |
|
Indicates a property that should be displayed to the user as bindable. |
|
Places an interface in the .idl file as a dual interface. |
|
Specifies an exported function or constant in a module by identifying the entry point in the DLL. |
|
Specifies the index of the first array element to be transmitted. |
|
Specifies a context ID that lets the user view information about this element in the Help file. |
|
Sets the name of the Help file for a type library. |
|
Specifies the ID of a help topic in an .hlp or .chm file. |
|
Specifies the name of the DLL to use to perform document string lookup (localization). |
|
Specifies a character string that is used to describe the element to which it applies. |
|
Indicates that the item exists but should not be displayed in a user-oriented browser. |
|
Specifies an entry point in a DLL. |
|
Allows you to use attributes or IDL constructs that are not supported in the current version of Visual C++. |
|
Specifies a DISPID for a member function (either a property or a method, in an interface or dispinterface). |
|
Specifies the IID of the COM interface pointed to by an interface pointer. |
|
Indicates that the database will be notified immediately of all changes to a property of a data-bound object. |
|
Makes types that have already been compiled into another type library available to the type library being created. |
|
Specifies another .idl, .odl, or header file containing definitions you want to reference from your main .idl file. |
|
Specifies one or more header files to be included in the generated .idl file. |
|
Causes an .idl or .h file to be included in the generated .idl file. |
|
Indicates that a parameter is to be passed from the calling procedure to the called procedure. |
|
Specifies the index of the last array element to be transmitted. |
|
Lets you pass a locale identifier to a function. |
|
Specifies the number of array elements to be transmitted. |
|
Indicates that the coclass to which it applies is licensed, and must be instantiated using IClassFactory2. |
|
Allows you to use the MIDL compiler as a header generator when used in the interface header. When used in an individual function, designates a local procedure for which no stubs are generated. |
|
Designates the maximum value for a valid array index. |
|
Defines the library block in the .idl file. |
|
Controls the network data representation alignment of nonencapsulated unions. |
|
Prevents the compiler from injecting code as a result of attribute use. |
|
Indicates that an interface member should not be displayed in a property browser. |
|
Defines an object that cannot be instantiated by itself. |
|
Specifies that the IDispatch implementation includes only the properties and methods listed in the interface description and cannot be extended with additional members at run time. |
|
Identifies a custom interface; synonymous with custom attribute. |
|
Identifies an interface as an Object Description Language (ODL) interface. |
|
Indicates that an interface is compatible with Automation. |
|
Specifies an optional parameter for a member function. |
|
Identifies pointer parameters that are returned from the called procedure to the calling procedure (from the server to the client). |
|
Specifies the default pointer attribute for all pointers except top-level pointers that appear in parameter lists. |
|
Emits the specified string, without the quote characters, into the generated .idl file. |
|
Specifies the ProgID for a COM object. |
|
Specifies a property accessor (get) function. |
|
Specifies a property setting function that uses a reference instead of a value. |
|
Specifies a property setting function. |
|
Designates a pointer as a full pointer. |
|
Ensures that a typedef will go into the type library even if it is not referenced from within the .idl file. |
|
Specifies a range of allowable values for arguments or fields whose values are set at run time. |
|
Prohibits assignment to a variable. |
|
Identifies a reference pointer. |
|
Indicates that the property supports the OnRequestEdit notification. |
|
Specifies that a library, or member of a module, interface, or dispinterface cannot be called arbitrarily. |
|
Designates the parameter that receives the return value of the member. |
|
Specifies the size of memory allocated for sized pointers, sized pointers to sized pointers, and single- or multidimensional arrays. |
|
Indicates that a member of a class, property, or method is a source of events. |
|
Indicates that the one-dimensional char, wchar_t, byte, or equivalent array or the pointer to such an array must be treated as a string. |
|
Specifies the expression or identifier acting as the union discriminant that selects the union member. |
|
Identifies the type of the variable used as the union discriminant. |
|
Instructs the compiler to associate a presented type, which client and server applications manipulate, with a transmitted type. |
|
Indicates that the type information member is the default member for display in the user interface. |
|
Specifies a unique pointer. |
|
Tells the caller that if there is an error when calling that function, the caller can then call GetLastError to retrieve the error code. |
|
Specifies the unique ID for a class or interface. |
|
Directs that the specified enumerated type be transmitted as a 32-bit entity, rather than the 16-bit default. |
|
Specifies that the function take a variable number of arguments. |
|
Specifies a version-independent form of the ProgID. |
|
Specifies a data type that will be used for transmission instead of an application-specific data type. |
See Also
Concepts
Attribute Limitations [redirect]