Поделиться через


Wrapper Classes

When you insert a control into a Visual C++ project, wrapper classes for the control are not included by default. However, if you want to modify the control's behavior, you can write a wrapper class for the control. Depending on how you intend to manipulate the control programmatically, you need to write one or more of the control's wrapper classes.

A wrapper class is available for each of the coclasses in the control's type library (.tlb) file. The control's wrapper class should be the control name prefixed by the letter C.

For more information about the functionality of the wrapper classes, see the object model for the control's base technology.

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

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

By reading the generated .idl file, you can determine what properties, methods, and events are exposed by a control, as well as see method and accessor function declarations directly. Additional information can be obtained from the control using the OLE/COM Object Viewer.

See Also

Reference

Using ActiveX Controls

Modifying a Control's Run-Time Behavior