Information for Visual Basic Programmers

Visual Basic provides full support for Automation. The following table lists how Visual Basic statements translate into OLE APIs.

Visual Basic statement OLE APIs
CreateObject (“ProgID”) CLSIDFromProgID

CoCreateInstance

QueryInterface to get IDispatch interface.

GetObject (“filename”, “ProgID”) CLSIDFromProgID

CoCreateInstance

QueryInterface for IPersistFile interface.

Load on IPersistFile interface.

QueryInterface to get IDispatch interface.

GetObject (“filename”) CreateBindCtx creates the bind context for the subsequent functions.

MkParseDisplayName returns a moniker handle for BindMoniker.

BindMoniker returns a pointer to the IDispatch interface.

Release on moniker handle.

Release on context.

GetObject (“ProgID”) CLSIDFromProgID

GetActiveObject on class ID.

QueryInterface to get IDispatch interface.

Dim x As New interface Find CLSID for interface.

CoCreateInstance

QueryInterface