defaultvtable attribute

The [defaultvtable] attribute defines an interface as the default Vtable interface.

[
    coclass-attribute-list, 
    defaultvtable
]
coclass coclass-name
{
    coclass-interface-list
}

Parameters

coclass-attribute-list

Other attributes that apply to the class. The [source] and [uuid] attributes are required.

coclass-name

The name of the class.

coclass-interface-list

A list of interfaces for the class.

Remarks

A default Vtable interface cannot be a dispinterface—it must be a dual or Vtable or interface. If the interface is a dual interface, then sinks can assume that they will receive events through Vtable.

A class can be both a default source interface and a default Vtable source interface as shown in the example. In this case an advise sink should use IID_IDISPATCH to receive dispatch events and use the interface identifier to receive Vtable events.

Typeflag Representation

The presence of IMPLTYPEFLAG_FDEFAULTVTABLE.

Examples

[
    dual,
    uuid(12345678-1234-1234-1234-123456789ABC),
    restricted
]
interface IForm: IDispatch
{
    [propget] HRESULT Backcolor([out, retval] long *Value);
    [propput] HRESULT Backcolor([in] long Value);
    [propget] HRESULT Name([out, retval] BSTR *Value);
    [propput] HRESULT Name([in] BSTR Value);}

[
    dual,
    uuid(1e196b20-1f3c-1069-996b-00dd010fe676),
    restricted
]
interface IFormEvents: IDispatch
{
    HRESULT Click();
    HRESULT Resize();}

    [
        uuid(1e123456-1f3c-1069-996b-123456789ABC)
    ]
    coclass Form
    {
        [default] interface IForm;
        [default, defaultvtable, source] interface IFormEvents;
    }
}

See also

coclass

ODL File Syntax

ODL File Example

Generating a Type Library With MIDL

source

uuid