Partager via


How Do I Deal with Licensed Controls?

If you need to host licensed controls, or controls that have other specialized initialization needs, you will need to create the control yourself before attaching it to a host window. You can do this using the following steps:

  1. Create the control (for example, use IClassFactory2).

  2. Initialize the control (for example, call IPersistStreamInit::New or IPersistStreamInit::Load).

  3. Create a CAxWindow2T Class object.

  4. Call CAxWindow::Create with an empty string as the title (this will create an "AtlAxWin80" window and host object without loading a control).

  5. Call CAxWindow::QueryHost to get the IAxWinHostWindow interface of the host object.

  6. Call IAxWinHostWindow::AttachControl to attach the control you just created to its container.

See Also

Concepts

ATL Control Containment FAQ