Condividi tramite


Interface Attributes

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

Attribute

Description

async_uuid

Specifies the UUID that directs the MIDL compiler to define both synchronous and asynchronous versions of a COM interface.

custom

Lets you define your own attributes.

dispinterface

Places an interface in the .idl file as a dispatch interface.

dual

Places an interface in the .idl file as a dual interface.

export

Causes a data structure to be placed in the .idl file.

helpcontext

Specifies a context ID that lets the user view information about this element in the Help file.

helpfile

Sets the name of the Help file for a type library.

helpstring

Specifies a character string that is used to describe the element to which it applies.

helpstringcontext

Specifies the ID of a help topic in an .hlp or .chm file.

helpstringdll

Specifies the name of the DLL to use to perform document string lookup (localization).

hidden

Indicates that the item exists but should not be displayed in a user-oriented browser.

library_block

Places a construct inside the .idl file's library block.

local

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.

nonextensible

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. This attribute is only valid on a dual interface.

odl

Identifies an interface as an Object Description Language (ODL) interface.

object

Identifies a custom interface.

oleautomation

Indicates that an interface is compatible with Automation.

pointer_default

Specifies the default pointer attribute for all pointers except top-level pointers that appear in parameter lists.

ptr

Designates a pointer as a full pointer.

restricted

Designates which members of the library cannot be called arbitrarily.

uuid

Provides 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.

See Also

Concepts

Attributes by Usage