oleautomation

[ oleautomation, uuid(string-uuid)interface-attribute-list
     interface
 interface-name : base-interface

string-uuid
Specifies a UUID string generated by the uuidgen utility.
interface-attribute-list
Specifies other attributes that apply to the interface as a whole.
interface-name
Specifies the name of the interface.
base-interface
Specifies the name of an OLE Automation interface from which this derived interface inherits member functions, status codes, and interface attributes. All OLE Automation interfaces are derived from IUnknown or IDispatch.

Example

library Hello
{
 importlib("stdole32.tlb");
    [
      uuid( . . .),
      helpstring("Application object for the Hello application."),
      oleautomation,
      dual
    ]
    interface IHello : IDispatch
    {. . .} 
 

Remarks

The oleautomation attribute indicates that an interface is compatible with OLE Automation. The parameters and return types specified for its members must be OLE Automation-compatible, as listed in the following table.

Type Description
boolean The MIDL base type boolean is incompatible with the oleautomation attribute. Use VARIANT_BOOL instead.
unsigned char 8-bit unsigned data item.
Double 64-bit IEEE floating-point number.
Float 32-bit IEEE floating-point number.
Int Integer whose size is system dependent. On 32-bit platforms, MIDL treats int as a 32-bit signed integer.
Long 32-bit signed integer.
Short 16-bit signed integer.
BSTR Length-prefixed string, as described in the OLE Automation topic BSTR.
CY (Formerly CURRENCY) 8-byte fixed-point number.
DATE 64-bit floating-point fractional number of days since December 30, 1899.
SCODE Built-in error type that corresponds to HRESULT.
Enum Signed integer, whose size is system-dependent. In remote operations, enum objects are treated as 16-bit unsigned entities. Applying the v1_enum attribute to an enum type definition allows enum objects to be transmitted as 32-bit entities.
IDispatch * Pointer to IDispatch interface (VT_DISPATCH).
IUnknown * Pointer to interface that is not derived from IDispatch (VT_UNKNOWN). (Any OLE interface can be represented by its IUnknown interface.)

A parameter is compatible with OLE Automation if its type is an OLE Automation-compatible type, a pointer to an OLE Automation-compatible type, or a SAFEARRAY of an OLE Automation-compatible type.

A return type is compatible with OLE Automation if its type is an HRESULT, SCODE or void. However, MIDL requires that interface methods return either HRESULT or SCODE. Returning void generates a compiler error.

A member is compatible with OLE Automation if its return type and all its parameters are OLE-Automation compatible.

An interface is compatible with OLE Automation if it is derived from IDispatch or IUnknown, it has the oleautomation attribute, and all of its VTBL entries are OLE-Automation compatible. For 32-bit platforms, the calling convention for all methods in the interface must be STDCALL. For 16-bit systems, all methods must have the CDECL calling convention.

Every dispinterface is implicitly OLE Automation-compatible. Therefore you should not use the oleautomation attribute on dispinterfaces.

The oleautomation attribute is not available when you compile using the MIDL compiler /osf switch.

Flags

TYPEFLAG_FOLEAUTOMATION

See Also

ODL File Syntax, ODL File Example, Generating a Type Library With MIDL, Differences Between MIDL and MKTYPLIB, IDL, uuid