ActiveX Control Containers: Connecting an ActiveX Control to a Member Variable
| Overview | How Do I | | Sample
The easiest way to access an ActiveX control from within its control container application is to associate the ActiveX control with a member variable of the dialog class that will contain the control.
Note This is not the only way to access an embedded control from within a container class, but for the purposes of this article it is sufficient.
Adding a member variable to the dialog class
Load your ActiveX container project.
On the View menu, click ClassWizard.
Choose the Member Variables tab.
In the Class Name list box, select the main dialog class. For example,
CContainerDlg
.In the Control IDs list box, select the control ID of the embedded ActiveX control. For example,
IDC_CIRC2CTRL1
.Click Add Variable.
The Add Member Variable dialog box appears.
In the Member Variable Name box enter a name.
For example,
m_circ2ctl
.In the Category box, click Control.
The Variable Type edit box automatically contains the name of the control wrapper class.
Note Additional entries in the Category drop-down list box are for exposed properties of the ActiveX control.
Click OK to close the Add Member Variables dialog box.
Click OK to accept your choices and exit ClassWizard.