Creating Applications and Tools that Access Objects

Automation provides interfaces for accessing exposed objects from an application or programming tool written in C or C++. The following sections show C++ code that uses the same type of access method as the Visual Basic code, which is described in Creating Scripts Using Visual Basic. Although the process is more complex with C++ than with Visual Basic, the approach is similar. This section shows the minimum code necessary to access and manipulate a remote object.

You can use the IDispatch interface to access ActiveX objects, or you can access objects directly through the VTBL. Because VTBL references can be bound at compile time, VTBL access is generally faster than through IDispatch. Whenever possible, use the ITypeInfo or ITypeInfo2 interfaces to get information about an object, including the VTBL addresses of the object's members. Then, use this information to access ActiveX objects through the VTBL.

To create compilers and other programming tools that use information from type libraries, use the ITypeComp interface. This interface binds to exposed objects at compile time. For details on ITypeComp see Type Description Interfaces.

In this section

Topic Description
Accessing Members Through VTBLs
Demonstrates how to access a member through its vtable.
Accessing Members Through IDispatch
Demonstrates how to access members through IDispatch.