SUBCLASS: Subclasses an Edit Control Using MFC

SUBCLASS subclasses an edit control in a dialog box and
makes it accept either numbers or letters. SUBCLASS uses
five classes inherited from CEdit, CSubclassedEdit,
CModalDialog, CWinApp, and CFrameWnd.

SUBCLASS subclasses a window by replacing the window
procedure for that window with AfxWndProc, and attaching
the window to a CWnd object. MFC provides two functions to
subclass a window: SubclassWindow and SubclassDlgitem.
These functions store the old window procedure in the
location returned by GetSuperWndProcAddr.

 To change the behavior of the target window, SUBCLASS
overloads the appropriate functions for the CWnd object.

You can change the behavior of a subclassed window by
subclassing it with a different CWnd object. Before
calling the subclassing function on that window, you must
first "unsubclass" the window. MFC does not provide a
function to unsubclass a window. You must call
::SetWindowLong to replace the AfxWndProc with the
original window procedure, then detach the CWnd object
from the target window.

SUBCLASS subclasses an edit control in a dialog box to
accept either numbers or letters. The CSubclassedEdit
class is derived from CEdit, and UnSubclass is declared as
its member function. Two additional classes
(CSubNumberEdit and CSubLetterEdit) are derived from
CSubclassedEdit to provide the two behaviors for the edit
control. The OnChar function is overloaded for both of
these classes.

The dialog-box class is derived from CModalDialog and has
two member data objects: SubNumberEdit and CSubLetterEdit.

KEYWORDS: PR-CD2; afx
