CTRLTEST: Demonstrates Custom Control Test Driver
CTRLTEST (in the DCONTROL.H, DCONTROL.CPP and DCONTROL.RC files) provides a simple frame window with a single menu to test custom controls. The application can be extended easily for additional tests.
All examples are based on the CParsedEdit class, which is derived from the standard Microsoft(R) Windows(TM) CEdit class. CParsedEdit provides a simple keyboard input filter that allows only numbers, letters, control characters, combinations of the above, or characters.
This sample also includes MUSCROLL.DLL, which is a "micro scrolling" custom control provided in the Windows version 3.1 Software Development Kit (SDK), and tests for Windows for Pen Computing edit items (requires Windows for Pen Computing).
The source code illustrates the following concepts:
Example parsed edit control (CParsedEdit) derived from the standard Windows CEdit class.
Bitmap buttons.
Owner-drawn and self-drawn controls.
Owner-drawn and self-drawn menus.
Using C++ to create controls for a dialog using Create member functions for the controls (in the DERTEST.CPP and DERTEST.DLG files; not recommended).
Exporting custom controls and registering a new WndClass so the controls can be used by the dialog manager (the PAREDIT control class used in WCLSTEST.CPP and WCLSTEST.DLG). You can edit these controls with the SDK Dialog Editor (DLGEDIT.EXE) by typing in the class name PAREDIT and the hexadecimal representation of the PES_ styles.
Using SubclassWindow and SubclassDlgItem to subclass a dialog control dynamically and add specialized behavior (in SUBTEST.CPP and SUBTEST.DLG).
Example of an external control packed as a DLL (MUSCROLL.DLL) being used by C++ code with a special C++ wrapper class.
Example of a spin button using the external MUSCROLL.DLL.
Examples of Windows for Pen Computing special edit controls.
ON_CONTROL handler (in WCLSTEST.CPP) responding to new control notification PEN_INVALIDCHAR).
Example of how style bits (PES_ style bits for the parsed edit) can be stripped off before the normal CEdit control is created.
For more information on these concepts, please see the technical article "MFC TN014--Custom Controls and Other Topics."
CTRLTEST requires special MFC libraries and include files; see the "MFC Libraries" and "MFC Include Files" abstracts to copy these files to your development system. CTRLTEST uses the following libraries: MLIBCEW.LIB (C Windows runtime library), LIBW.LIB (Windows library), either MAFXCW.LIB (MFC medium-model Windows retail library or MAFXCWD.LIB (MFC medium-model Windows debug library), and COMMDLG.DLL.
To build this application, you must have Microsoft C/C++ version 7.0 installed on your system.
{ewc navigate.dll, ewbutton, /Bcodeview /T"Click to open or copy files in the ctrltest project." /C"samples}