IDispatch Interface

[This is preliminary documentation and subject to change.]

The IDispatch interface provides the tools that some developers need to work between C/C++ applications and Microsoft Visual Basic® applications. This interface essentially provides an indirect way to expose object methods and properties. The IDispatch method provides information about what methods an object supports, provides identifiers for those methods, and executes them on the caller's behalf if needed.

Many objects built on OLE expose the IDispatch interface to support OLE Automation. Server applications must support the IDispatch interface for this purpose. However, since C/C++ client developers need not interact with VB applications, they should use the IAccessible interface to achieve the best performance. Because most Active Accessibility API functions retrieve objects by way of their IDispatch interface, you'll often need to retrieve an IAccessible interface by calling the object's QueryInterface method and specifying the IID_IAccessible reference identifier as the iid parameter.

Oleacc.h defines the following DISPID values for use with the IDispatch interface.

// PROPERTIES: Hierarchical
#define DISPID_ACC_PARENT                   (-5000)
#define DISPID_ACC_CHILDCOUNT               (-5001)
#define DISPID_ACC_CHILD                    (-5002)
                                             
// PROPERTIES:  Descriptional
#define DISPID_ACC_NAME                     (-5003)
#define DISPID_ACC_VALUE                    (-5004)
#define DISPID_ACC_DESCRIPTION              (-5005)
#define DISPID_ACC_ROLE                     (-5006)
#define DISPID_ACC_STATE                    (-5007)
#define DISPID_ACC_HELP                     (-5008)
#define DISPID_ACC_HELPTOPIC                (-5009)
#define DISPID_ACC_KEYBOARDSHORTCUT         (-5010)
#define DISPID_ACC_FOCUS                    (-5011)
#define DISPID_ACC_SELECTION                (-5012)
#define DISPID_ACC_DEFAULTACTION            (-5013)

// METHODS
#define DISPID_ACC_SELECT                   (-5014)
#define DISPID_ACC_LOCATION                 (-5015)
#define DISPID_ACC_NAVIGATE                 (-5016)
#define DISPID_ACC_HITTEST                  (-5017)
#define DISPID_ACC_DODEFAULTACTION          (-5018)

For more information about the IDispatch interface, OLE Automation, and COM, see the references discussed in Where to Find More Information.