Interface Attributes

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The following attributes apply to the interface (or __interface) C++ keyword.

AttributeDescription
async_uuidSpecifies the UUID that directs the MIDL compiler to define both synchronous and asynchronous versions of a COM interface.
customLets you define your own attributes.
dispinterfacePlaces an interface in the .idl file as a dispatch interface.
dualPlaces an interface in the .idl file as a dual interface.
exportCauses a data structure to be placed in the .idl file.
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.
helpstringcontextSpecifies the ID of a help topic in an .hlp or .chm file.
helpstringdllSpecifies the name of the DLL to use to perform document string lookup (localization).
hiddenIndicates that the item exists but should not be displayed in a user-oriented browser.
library_blockPlaces a construct inside the .idl file's library block.
localAllows 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.
nonextensibleSpecifies 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. This attribute is only valid on a dual interface.
odlIdentifies an interface as an Object Description Language (ODL) interface.
objectIdentifies a custom interface.
oleautomationIndicates that an interface is compatible with Automation.
pointer_defaultSpecifies the default pointer attribute for all pointers except top-level pointers that appear in parameter lists.
ptrDesignates a pointer as a full pointer.
restrictedDesignates which members of the library cannot be called arbitrarily.
uuidProvides the unique ID for the library

You must observe these rules for defining an interface:

  • Default calling convention is __stdcall.

  • A GUID is supplied for you if you do not supply one.

  • No overloaded methods are allowed.

When not specifying the uuid attribute and using the same interface name in different attribute projects, the same GUID is generated.

Attributes by Usage

Show: