Share via


Adding a Class from an ActiveX Control

Use this wizard to create an MFC class from an interface in an available ActiveX control. You can add an MFC class to an MFC application, an MFC DLL, or an MFC ActiveX control.

Note

You do not need to create your MFC project with Automation enabled to add a class from an ActiveX control.

An ActiveX control is a reusable software component based on the Component Object Model (COM) that supports a wide variety of OLE functionality and can be customized to fit many software needs. ActiveX controls are designed for use both in ordinary ActiveX control containers and on the Internet in World Wide Web pages.

To add an MFC class from an ActiveX control

  1. In either Solution Explorer or Class View, right-click the name of the project to which you want to add the ActiveX control class.

  2. From the shortcut menu, click Add, and then click Add Class.

  3. In the Add Class dialog box, in the Templates pane, click MFC Class from ActiveX Control, and then click Open to display the Add Class from ActiveX Control Wizard.

In the wizard, you can add more than one interface in an ActiveX control. Likewise, you can create classes from more than one ActiveX control in a single wizard session.

You can add classes from ActiveX controls registered in your system, or you can add classes from ActiveX controls located in type library files (.tlb, .olb, .dll, .ocx, or .exe) without first registering them in your system. See Registering OLE Controls for more information on registering ActiveX controls.

The wizard creates an MFC class, derived from CWnd or from COleDispatchDriver, for each interface you add from the selected ActiveX control.

See Also

Concepts

MFC ActiveX Controls

Other Resources

Introduction to COM and ATL