IDispatch.3w

Langue: en

Version: Jun 2009 (debian - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

IDispatch

NOTES

The IDispatch interface provides a single interface to dispatch method calls, regardless of whether the object to be called is in or out of process, local or remote (e.g. being called over a network). This interface is late-bound (linked at run-time), as opposed to early-bound (linked at compile time).

The interface is used by objects that wish to called by scripting languages such as VBA, in order to minimise the amount of COM and C/C++ knowledge required, or by objects that wish to live out of process from code that will call their methods.

Method, property and parameter names can be localised. The details required to map names to methods and parameters are collected in a type library, usually output by an IDL compiler using the objects IDL description. This information is accessible programmatically through the ITypeLib interface (for a type library), and the ITypeInfo interface (for an object within the type library). Type information can also be created at run-time using CreateDispTypeInfo(3w).

WRAPPERS

Instead of using IDispatch directly, there are several wrapper functions available to simplify the process of calling an objects methods through IDispatch.

A standard implementation of an IDispatch object is created by calling CreateStdDispatch(). Numeric Id values for the parameters and methods (DISPIDs) of an object of interest are retrieved by calling DispGetIDsOfNames(3w). DispGetParam(3w) retrieves information about a particular parameter. Finally the DispInvoke(3w) function is responsible for actually calling methods on an object.

METHODS

IDispatch_QueryInterface().

IDispatch_AddRef().

IDispatch_Release().

IDispatch_GetTypeInfoCount().

IDispatch_GetTypeInfo().

IDispatch_GetIDsOfNames().

IDispatch_Invoke().