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:
-
Create the control (for example, use IClassFactory2).
-
Initialize the control (for example, call IPersistStreamInit::New or IPersistStreamInit::Load).
-
Create a CAxWindow object.
-
Call CAxWindow::Create with an empty string as the title (this will create an "AtlAxWin" window and host object without loading a control).
-
Call CAxWindow::QueryHost to get the IAxWinHostWindow interface of the host object.
-
Call IAxWinHostWindow::AttachControl to attach the control you just created to its container.
ATL Control Containment FAQ