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)
-
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.
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.
interface IKnown : IUnknown
{
properties:
[id(90), propget,
helpstring("A meaningful comment."] long Func1(void);
/* Other interface statements */
}