Declaring a Variable Based on Your New Control Class
Once you have created an MFC control class, you can declare a variable based on it. To provide a context for the new variable, you must open the dialog editor and edit the dialog box in which you want to use your reusable control. Also, the dialog box must already have a class associated with it. For information on using the dialog editor, see Dialog Editor.
To declare a variable based on your reusable class
While editing the dialog box, drag a control of the same type as the base class of your new control from the Controls toolbar onto the dialog box.
Place the mouse pointer over the dropped control.
While pressing the CTRL key, double-click the control.
The Add Member Variable dialog box appears.
In the Access box, select the correct access for your control.
Click the Control variable check box.
In the Variable name box, type a name.
Under Category, click Control.
In the Control ID list, pick the control that you added. The Variable type list should display the correct variable type, and the Control type box should display the correct control type.
In the Comment box, add any comment you want to appear in your code.
Click OK.
See also
Mapping Messages to Functions
Adding Functionality with Code Wizards
Adding a Class
Adding a Member Function
Adding a Member Variable
Overriding a Virtual Function
MFC Message Handler
Navigating the Class Structure