IAxWinHostWindow Interface

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at IAxWinHostWindow Interface.

This interface provides methods for manipulating a control and its host object.

System_CAPS_ICON_important.jpg Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

interface IAxWinHostWindow : IUnknown

Methods

AttachControlAttaches an existing control to the host object.
CreateControlCreates a control and attaches it to the host object.
CreateControlExCreates a control, attaches it to the host object, and optionally sets up an event handler.
QueryControlReturns an interface pointer to the hosted control.
SetExternalDispatchSets the external IDispatch interface.
SetExternalUIHandlerSets the external IDocHostUIHandlerDispatch interface.

This interface is exposed by ATL's ActiveX control hosting objects. Call the methods on this interface to create and/or attach a control to the host object, to get an interface from a hosted control, or to set the external dispinterface or UI handler for use when hosting the Web browser.

The definition of this interface is available as IDL or C++, as shown below.

Definition typeFile
IDLATLIFace.idl
C++ATLIFace.h (also included in ATLBase.h)

Attaches an existing (and previously initialized) control to the host object using the window identified by hWnd.

STDMETHOD(AttachControl)(IUnknown* pUnkControl, HWND hWnd);

Parameters

pUnkControl
[in] A pointer to the IUnknown interface of the control to be attached to the host object.

hWnd
[in] A handle to the window to be used for hosting.

Return Value

A standard HRESULT value.

Creates a control, initializes it, and hosts it in the window identified by hWnd.

STDMETHOD(CreateControl)(
    LPCOLESTR lpTricsData,
    HWND hWnd,
    IStream* pStream);

Parameters

lpTricsData
[in] A string identifying the control to create. Can be a CLSID (must include the braces), ProgID, URL, or raw HTML (prefixed by MSHTML:).

hWnd
[in] A handle to the window to be used for hosting.

pStream
[in] An interface pointer for a stream containing initialization data for the control. Can be NULL.

Return Value

A standard HRESULT value.

Remarks

This window will be subclassed by the host object exposing this interface so that messages can be reflected to the control and other container features will work.

Calling this method is equivalent to calling IAxWinHostWindow::CreateControlEx.

To create a licensed ActiveX control, see IAxWinHostWindowLic::CreateControlLic.

Creates an ActiveX control, initializes it, and hosts it in the specified window, similar to IAxWinHostWindow::CreateControl.

STDMETHOD(CreateControlEx)(
    LPCOLESTR lpszTricsData,
    HWND hWnd,
    IStream* pStream,
    IUnknown** ppUnk,
    REFIID riidAdvise,
    IUnknown* punkAdvise);

Parameters

lpTricsData
[in] A string identifying the control to create. Can be a CLSID (must include the braces), ProgID, URL, or raw HTML (prefixed with MSHTML:).

hWnd
[in] A handle to the window to be used for hosting.

pStream
[in] An interface pointer for a stream containing initialization data for the control. Can be NULL.

ppUnk
[out] The address of a pointer that will receive the IUnknown interface of the created control. Can be NULL.

riidAdvise
[in] The interface identifier of an outgoing interface on the contained object. Can be IID_NULL.

punkAdvise
[in] A pointer to the IUnknown interface of the sink object to be connected to the connection point on the contained object specified by iidSink.

Return Value

A standard HRESULT value.

Remarks

Unlike the CreateControl method, CreateControlEx also allows you to receive an interface pointer to the newly created control and set up an event sink to receive events fired by the control.

To create a licensed ActiveX control, see IAxWinHostWindowLic::CreateControlLicEx.

Returns the specified interface pointer provided by the hosted control.

STDMETHOD(QueryControl)(REFIID riid, void** ppvObject);

Parameters

riid
[in] The ID of an interface on the control being requested.

ppvObject
[out] The address of a pointer that will receive the specified interface of the created control.

Return Value

A standard HRESULT value.

Sets the external dispinterface, which is available to contained controls through the IDocHostUIHandlerDispatch::GetExternal method.

STDMETHOD(SetExternalDispatch)(IDispatch* pDisp);

Parameters

pDisp
[in] A pointer to an IDispatch interface.

Return Value

A standard HRESULT value.

Call this function to set the external IDocHostUIHandlerDispatch interface for the CAxWindow object.

STDMETHOD(SetExternalUIHandler)(IDocHostUIHandlerDispatch* pDisp);

Parameters

pDisp
[in] A pointer to an IDocHostUIHandlerDispatch interface.

Return Value

A standard HRESULT value.

Remarks

This function is used by controls (such as the Web browser control) that query the host's site for the IDocHostUIHandlerDispatch interface.

IAxWinAmbientDispatch Interface
CAxWindow::QueryHost
AtlAxGetHost

Show: