defaultbind attribute

The [defaultbind] attribute indicates the single, bindable property that best represents the object.

[
    interface-attribute-list
] 
interface | dispinterface interface-name 
{
    [bindable, defaultbind [, attribute-list]] returntype function-name(params)
}

Parameters

interface-attribute-list

Specifies a list of one or more attributes that apply to the interface as a whole. When two or more interface attributes are present, they must be separated by commas.

interface-name

Specifies the name of the interface.

attribute-list

Specifies a list of one or more attributes that apply to the function. When two or more interface attributes are present, they must be separated by commas.

returntype

Specifies the return type of the function.

function-name

Specifies the name of the function to which the [defaultbind] attribute will be applied.

params

Function parameter list.

Remarks

Properties that have the [defaultbind] attribute must also have the [bindable] attribute. Only one property in an interface or dispinterface can have the [defaultbind] attribute.

This attribute is used by containers that have a user model involving binding to an object rather than binding to a property of an object. An object can support data binding but not have this attribute.

Flags

FUNCFLAG_FDEFAULTBIND, VARFLAG_FDEFAULTBIND

Examples

[
    uuid(12345678-1234-1234-1234-123456789ABC)
] 
interface MyObject : IUnknown
{
    properties:
    methods:
        [id(1), propget, bindable, 
         defaultbind, displaybind] long Size(void);

        [id(1), propput, bindable, 
         defaultbind, displaybind] HRESULT Size([in]long lSize);
}

See also

bindable

Generating a Type Library With MIDL

ODL File Example

ODL File Syntax

TYPEFLAGS