Compartilhar via


AtlAxCreateControlLicEx

Creates a licensed ActiveX control, initializes it, and hosts it in the specified window. An interface pointer and event sink for the new control can also be created.

Important

This function cannot be used in applications that execute in the Windows Runtime.

ATLAPI AtlAxCreateControlLicEx( 
LPCOLESTR lpszName,  
HWND hWnd,  
IStream* pStream, 
IUnknown** ppUnkContainer,  
IUnknown** ppUnkControl, 
REFIID iidSink = IID_NULL,  
IUnknown* punkSink = NULL,  
BSTR bstrLic= NULL 
);

Parameters

  • lpszName
    A pointer to a string to be passed to the control. Must be formatted in one of the following ways:

    • A ProgID such as "MSCAL.Calendar.7"

    • A CLSID such as "{8E27C92B-1264-101C-8A2F-040224009C02}"

    • A URL such as "https://www.microsoft.com"

    • A reference to an Active document such as "file://\\Documents\MyDoc.doc"

    • A fragment of HTML such as "MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>"

      Note

      "MSHTML:" must precede the HTML fragment so that it is designated as being an MSHTML stream.

  • hWnd
    Handle to the window that the control will be attached to.

  • pStream
    A pointer to a stream that is used to initialize the properties of the control. Can be NULL.

  • ppUnkContainer
    The address of a pointer that will receive the IUnknown of the container. Can be NULL.

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

  • iidSink
    The interface identifier of an outgoing interface on the contained object.

  • punkSink
    A pointer to the IUnknown interface of the sink object to be connected to the connection point specified by iidSink on the contained object after the contained object has been successfully created.

  • bstrLic
    The BSTR containing the license for the control.

Return Value

One of the standard HRESULT values.

Remarks

AtlAxCreateControlLicEx is similar to AtlAxCreateControlLic but 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.

Example

See Hosting ActiveX Controls Using ATL AXHost for a sample of how to use AtlAxCreateControlLicEx.

Requirements

Header: atlhost.h

See Also

Reference

AtlAxCreateControl

CAxWindow2T::CreateControlLicEx

Concepts

ATL Composite Control Fundamentals

Other Resources

Composite Control Global Functions