Home | Overview | How Do I | Tutorial | Sample
If you did not enable ActiveX control support when you used AppWizard to generate your application, you will have to add this support manually. This article describes the process for manually adding ActiveX control containment to an existing OLE container application. If you know in advance that you want ActiveX control support in your OLE container, see the article Overview: Creating an ActiveX Control Container. In addition, you can use the Gallery’s ActiveX control Containment component to automatically add control containment to your application.
Note This article uses a dialog-based ActiveX control container project named Container and an embedded control named Circ2 as examples in the procedures and code.
To support ActiveX controls, you must add one line of code to two of your project’s files.
InitInstance
function (found in CONTAINER.CPP) by making a call to AfxEnableControlContainer, as in the following example:
// CContainerApp initialization
BOOL CContainerApp::InitInstance()
{
AfxEnableControlContainer();
...
}
#include <Afxdisp.h>
After you have completed these steps, rebuild your project by clicking Build on the Build menu.