Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
id
id
in
int
odl
out
ptr
ref
Collapse the table of content
Expand the table of content

id attribute

The [id] attribute specifies a DISPID for a member function (either a property or a method, in an interface or dispinterface).


[id(id-num) [,optional-attribute-list]] return-type function-name(optional-parameter-list)

Parameters

id-num

DISPID for the function.

optional-attribute-list

Specifies a list of zero or more MIDL interface attributes.

return-type

Specifies the return type of the function.

function-name

Specifies the name of the function in the IDL file.

optional-parameter-list

Zero or more function parameters.

Remarks

Use the [id] attribute when you want to assign a standard DISPID (like DISPID_VALUE, DISPID_NEWENUM etc.) to a method or property, or when you implement your own IDispatch::Invoke instead of delegating to DispInvoke/ITypeInfo::Invoke.

If you do not use the [id] attribute on an interface, the MIDL compiler will assign a DISPID for you. However, when you specify a dispinterface by using properties and methods, you must specify a DISPID for every property and method.

The id-num is a 32-bit positive integral value. Negative IDs are reserved for use by Automation.

Examples

interface IKnown : IUnknown
{
    properties:
        [id(90), propget, 
         helpstring("A meaningful comment."] long Func1(void);

    /* Other interface statements */
}

See also

interface
dispinterface
ODL File Syntax
ODL File Example
Generating a Type Library With MIDL

 

 

Community Additions

ADD
Show:
© 2015 Microsoft