Copyright: ActiveX Control Containment Help


ActiveX Control Containment: Overview

The ActiveX control containment component adds ActiveX control support to your application. Once you have inserted this component, your application can support embedded ActiveX controls in any CCmdTarget-derived class, such as a dialog or view.

ActiveX Control Containment: Specifics

ActiveX Control Containment: Results


ActiveX Control Containment: Specifics

To support ActiveX control containment, a project must include afxdisp.h and a call to AfxEnableControlContainer in the InitInstance function. This function is a member of the project's CWinApp-derived class.

For more information on ActiveX control containment, see topics on the ActiveX Control Containers in the Details section of Adding User Interface Features.  You can also see the Container Application section in the Visual C++ Tutorials.


ActiveX Control Containment: Results

When the component is inserted, two lines are added in two files of the project.

•	The first line is an include file, afxdisp.h, that is needed by any embedded ActiveX control. It is placed at the end of your stdafx.h file. Afxdisp.h is one of many include file provided by Microsoft and should not be modified in any way.

•	The second line is a call to the function AfxEnableControlContainer, a global function provided by Microsoft. It is placed at the beginning of your application's InitInstance function. This function can be found in PROJECT.CPP, where PROJECT is the name of the project. This function enables support for ActiveX control containment.

Both lines of code are suffixed by the comment:

//added by OCC component

Once you have inserted this component, see the article "ActiveX Control Containers: Inserting a Control into a Control Container Application" in the Details section of Adding User Interface Features in the Visual C++ Programmer’s Guide.