This documentation is archived and is not being maintained.

Controls Samples

The topics in this section are the abstracts for the MFC ActiveX controls samples. For a list of all MFC samples, see MFC Samples.

An ActiveX control (formerly OLE control) is an ActiveX object with an extended interface that lets it behave like a control for Microsoft Windows.

ActiveX Controls

The following samples demonstrate ActiveX controls:

  • BUTTON   A control subclassed from a Windows button control. Demonstrates use of an in-place active menu, a stock property page, and the About box control option.
  • CIRC   A simple circle control that illustrates painting, stock properties, custom properties, mouse events, custom events, adding text and fonts, property pages, and data binding.
  • DB   A control that illustrates use of the CRecordSet and CDatabase classes.
  • IMAGE   A control that is capable of downloading data asynchronously.
  • LICENSED   A control that enforces use of a design-time and run-time license.
  • LOCALIZE   A control with a localized user interface. Demonstrates use of separate type libraries and resource dynamic-link libraries (DLL) for localization.
  • PAL   A control that displays the colors of a palette. Demonstrates read-only properties, persistent Get/Set properties, persistent parameterized properties, and picture properties.
  • PUSH   A control subclassed from a Windows owner-drawn button control. Demonstrates stock properties, custom events, and picture holders.
  • REGSVR   This utility is used to invoke the self-registration code built into ActiveX Controls to add or remove a control's information in the registry.
  • SPINDIAL   A control with the visual appearance of a spin-dial. Demonstrates property page data validation.
  • TESTHELP   A control that has its own help file to display help for the user.
  • TIME   A control that is invisible at run time and fires a timer event at set intervals. Demonstrates notification functions and ambient properties.
  • XLIST   A control, subclassed from a Windows list box, that displays text or bitmap items. Demonstrates methods, ambient properties, picture holders, and font holders.

Containers

This section includes the following container samples:

  • CONTAINER   A simple example of a Visual Editing container application.
  • SMILEY   A simple ActiveX control container designed to show how easy it is to use MFC support to handle ActiveX controls.

Adding ActiveX Controls to the Toolbox

To place ActiveX controls or objects in the Toolbox window, see Customize Toolbox Dialog Box. Once inserted, the ActiveX controls can be dragged to the dialog box that you are constructing.

Tip   To quickly add registered ActiveX controls to a dialog box template, see Viewing and Adding ActiveX Controls to a Dialog Box.

Manual Registration of ActiveX Controls

For the following procedure to work, the ActiveX development tools must be installed and the development environment must be open.

  1. Open the ActiveX Control Test Container. See Testing Properties and Events with Test Container for information on how to access Test Container.
  2. On the File menu, click Register Controls.

    The Register Controls dialog box appears.

  3. Click Register and browse to the directory in which the ActiveX control is installed.
  4. In the File name list, double-click the file of the control. Test Container will register the control and add it to the list under Registered Controls in the Register Controls dialog box.
  5. Click Close to close the Register Controls dialog box. You can now insert your control in Test Container or in any dialog box or form you want.

Testing Controls in Test Container

The ActiveX Control Test Container is a tool for testing and debugging ActiveX controls. You can use it to test a control's functionality by changing the control's properties, invoking its methods, and firing its events. See Testing Properties and Events with Test Container for information on using Test Container.

See Also

MFC Samples

Show: