Returning the Extensibility Object

The GetExtensibilityObject method gives the host access to a special dispatch interface for the visual designer. This interface is not the same as the standard OLE dispatch interface; this special IDispatch is available to add-ins (such as servers that extend the Visual Basic environment) through the development environment's extensibility object.

Not all ActiveX Designers need to provide access to this extensibility object. You should implement this method if you want to provide the capability for your designer to be manipulated through the host's extensibility mechanism. If your ActiveX Designer doesn't have a separate run-time object, you can implement only this method and return E_NOTIMPL for the other IActiveDesigner methods.

The following example creates a new extensibility object and returns a pointer to its IDispatch interface for add-ins:

STDMETHODIMP CMyDesigner::GetExtensibilityObject
(
    IDispatch **ppExtensibilityObject
)
{
    if (!ppExtensibilityObject) return E_POINTER;

    *ppExtensibilityObject = new CMyAddInTopLevelAutomationObject;
    return (*ppExtensibilityObject) ? S_OK : E_OUTOFMEMORY;
}
 

If you don't implement the method, return E_NOTIMPL.