共用方式為


Using Custom Controls in the Dialog Editor

OverviewHow Do I

The lets you use existing “custom” or “user” controls in a dialog template.

Note   Custom controls in this sense are not to be confused with ActiveX controls. ActiveX controls — when they were known as OLE controls — were sometimes called OLE custom controls. Also, don’t confuse these controls with the owner-drawn controls in Windows.

This functionality is intended to let you use controls other than those supplied by Windows. At run time, the control is associated with a window class (not the same as a C++ class). A more common way to accomplish the same task is to install any control, such as a static control, in your dialog box. Then at run time, in the OnInitDialog function, remove that control and replace it with your own custom control.

This is an old technique. Today you are advised in most cases to write an ActiveX control or subclass a Windows common control.

For these custom controls, you are limited to:

  • Setting the location in the dialog box.

  • Typing a caption.

  • Identifying the name of the control’s Windows class (your application code must register the control by this name).

  • Typing a 32-bit hexadecimal value that sets the control’s style.

See Also   , , , , , ,