Article ID: 139072
Article Last Modified on 12/3/2003
139074 SAMPLE: VTBLBIND: Marshaling Using an OLE Automation Marshaler
[
uuid(2ED17402-F80F-11ce-8161-00AA0060D733), // ID_IVtblServer
oleautomation
]
interface IVtblServer : IUnknown
{
HRESULT put_Message([in] BSTR Message);
HRESULT get_Message([out] BSTR *pMessage);
HRESULT DisplayMessage([in] SAFEARRAY(unsigned char) Coordinate,
[in] short Times);
}
The IVtblServer custom interface derives from IUnknown and has three
methods. The uuid attribute specifies the Interface ID of the interface.
The oleautomation attribute specifies that the interface can be marshaled
by the marshaler provided by OLE Automation.124385 SAMPLE: OLE Automation '94 Documentation and Samples
short
16-bit signed integer.
long
32-bit signed integer.
float
32-bit IEEE floating-point number.
double
64-bit IEEE floating-point number.
CURRENCY
8-byte fixed-point number.
DATE
64-bit floating-point fractional number of days since December 30, 1899.
BSTR
Length-prefixed string. Strings must be passed using this type. BSTRs
must be created and manipulated using the functions described in OLE
Programmer's Reference, Vol. 2.
boolean
Data item that can have the values True or False. The size maps to
VARIANT_BOOL.
VARIANT
VARIANT type. This VARIANT can contain any type marked with a [V] in the
VARENUM enumeration in Oaidl.h. VARIANTs that contain other types cannot
be marshaled by OLE Automation.
SCODE
OLE scode.
unsigned char
Unsigned 8-bit data item. A SAFEARRAY(unsigned char) can be used to pass
binary data.
IUnknown*
IUnknown interface pointer. Any OLE interface can be passed using this
type.
IDispatch*
IDispatch interface pointer.
SAFEARRAY(type)
Array of type, which can be any of the previously-listed types but
cannot be any of the following types. Safearrays must be created and
manipulated using the Safearray functions described in OLE Programmer's
Reference, Vol. 2.
short*
pointer to a short. Can be used to pass a short by reference.
long*
pointer to a long. Can be used to pass a long by reference.
float*
pointer to a float. Can be used to pass a float by reference.
double*
pointer to a double. Can be used to pass a double by reference.
CURRENCY*
pointer to a CURRENCY. Can be used to pass a CURRENCY by reference.
DATE*
pointer to a DATE. Can be used to pass a DATE by reference.
BSTR*
pointer to a BSTR. Can be used to pass a BSTR by reference.
boolean*
pointer to a boolean. Can be used to pass a boolean by reference.
VARIANT*
pointer to a VARIANT. Can be used to pass a VARIANT by reference.
SCODE*
pointer to an scode. Can be used to pass an scode by reference.
unsigned char*
pointer to an unsigned char. Can be used to pass an unsigned char by
reference.
IUnknown**
Pointer to IUnknown*. Can be used to pass an IUnknown interface by
reference.
IDispatch**
Pointer to IDispatch*. Can be used to pass an IDispatch interface by
reference.
SAFEARRAY(type) *
Pointer to SAFEARRAY. Can be used to pass a SAFEARRAY by reference.
HRESULT
Return type used for reporting error information in interfaces. Can only
be used as a return type. Use SCODE for parameter types. SCODE and
HRESULT are the same in Win32.
122289 Passing Structures in OLE Automation
131046 SAMPLE: BINARY: Transfer Binary Data Using OLE Automation
HKEY_CLASSES_ROOT\Interface\{2ED17402-F80F-11ce-8161-00AA0060D733} =
IVtblServer
HKEY_CLASSES_ROOT\Interface\{2ED17402-F80F-11ce-8161-00AA0060D733}
\TypeLib = {2ED17400-F80F-11ce-8161-00AA0060D733}
HKEY_CLASSES_ROOT\Interface\{2ED17402-F80F-11ce-8161-00AA0060D733}
\ProxyStubClsid = {00020424-0000-0000-C000-000000000046}
HKEY_CLASSES_ROOT\Interface\{2ED17402-F80F-11ce-8161-00AA0060D733}
\ProxyStubClsid32 = {00020424-0000-0000-C000-000000000046}
{2ED17402-F80F-11ce-8161-00AA0060D733} corresponds to the Interface ID
of the custom interface. {00020424-0000-0000-C000-000000000046} is the
CLSID of the OLE Automation marshaler that will marshal this custom
interface. This is a CLSID that is provided by OLE. The TypeLib key
is used to point to the GUID of the type library that describes this
custom interface. When the custom interface is marshaled, OLE will look
up its interface registration in the system registry using the Interface
ID.
HKEY_CLASSES_ROOT\TypeLib\{2ED17400-F80F-11ce-8161-00AA0060D733}
HKEY_CLASSES_ROOT\TypeLib\{2ED17400-F80F-11ce-8161-00AA0060D733}\1.0 =
VtblServer 1.0 Type Library
HKEY_CLASSES_ROOT\TypeLib\{2ED17400-F80F-11ce-8161-00AA0060D733}
\1.0\0\win32 = server.tlb
{2ED17400-F80F-11ce-8161-00AA0060D733} is the GUID of the type library.
\1.0\0\win32 corresponds to version 1.0 and locale ID 0 (language neutral)
of the type library on the win32 platform. The version and locale ID
correspond to the version and lcid attributes in Server.odl. The locale ID
is important for late-binding in OLE automation and is not important for
vtbl-binding. The full path of Server.tlb is registered.
Additional query words: 4.00
Keywords: kbautomation KB139072