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 |
Data item
that can have the value TRUE or FALSE. In MIDL, the size corresponds to unsigned
char. |
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 VT_ERROR. |
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
Flags
TYPEFLAG_FOLEAUTOMATION
See Also