[id(id-num) [,optional-attribute-list]] return-type function-name
Interface IKnown : IUnknown
{
properties:
[id(90), propget, helpstring("A meaningful comment."]
long Func1(void);
. . .
}
The id attribute specifies a DISPID for a member function (either a property or a method, in an interface or dispinterface). You 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 integral value in the following format:
Bits | Value |
---|---|
0–15 | Offset. Any value is permissible. |
16–21 | The nesting level of this typeinfo in the inheritance hierarchy. For example:
The nesting level of IUnknown is 0, IDispatch is 1, and mydisp is 2. |
22–25 | Reserved; must be zero |
26–28 | DISPID value. |
29 | True if this is the member ID for a FuncDesc; otherwise False. |
30–31 | Must be 01. |
Negative IDs are reserved for use by OLE Automation.
interface, dispinterface, ODL File Syntax, ODL File Example, Generating a Type Library With MIDL