Wrapper Classes

When you insert a control, ClassWizard generates wrapper classes for each of the control's internal coclasses. These wrapper classes provide an easy programmatic interface for a control.

ClassWizard usually generates more than one wrapper class. You can identify the control's wrapper class by looking at the class names; the wrapper class should be the control name prefixed by the letter C. For example, you can also identify the control's wrapper by looking at the class declarations; the wrapper class that derives from , rather than from , is the control wrapper class.

Typically, you only need the wrapper class specific to the control itself. However, some of the Get functions (in the wrapper classes) return pointers to other coclasses as well. If these functions are generated but the wrapper classes for the return values are not generated, the application will not compile. Generally, unless you are familiar with the structure of the coclasses, it is better to generate all of the wrapper classes when you insert the control.

Using also requires wrapper classes since the return value must be cast to the control class. For example:

   CDBList* pDBList = 0;
   pDBList = static_cast<CDBList*>(GetDlgItem(IDC_DBLIST));

Back to Using ActiveX Controls.

See Also

Modifying a Control's Run-Time Behavior