home Tech Library Tech Forum
Publisher
 
Custom Controls in MFC       
 
 
SubClassing a Window
 
 

 

Subclassing is the term for replacing the WndProc of a window with a different WndProc and calling the old WndProc for default (superclass) functionality. A CWnd object gets attached to an existing window and you can modify the behavior in a derived class. This is called dynamic subclassing, since the behavior (and hence the class) of an object is changed at run time. Dynamic subclassing is done with either of the CWnd member functions:

CWnd::SubclassWindow()
CWnd::SubclassDlgItem()


These routines attach a CWnd object to an existing window. SubclassWindow() takes the window handle directly, and SubclassDlgItem() is a helper that takes a control ID and the parent window (usually a dialog). SubclassDlgItem() is designed for attaching C++ objects to dialog controls created from a dialog template.
 

   
   
  RELATED TOPICS  
Custom Controls in MFC
Common Controls in MFC
Creating the Common Controls
Slider Control and Styles
Spin Control and Styles
List View Control and Styles
Tree View Control and Styles
Notification Messages by Common Controls
Property Sheets
How to create a Modal Property Sheet
 


 
           
Home | Profile | Users | Library | Publisher | Tech Forum | News | Contact Us