A control on subclass dialog!
After a subclass control, replace its original windowproc with the windowproc of cyourcwndclass you wrote yourself, so that you can
You can process all the messages of this control. You can use classwizard to maintain your cyourcwndclass.
In MFC, in addition to subclassdlgitem, The subclasswindow function is used to execute the same function. In association with a widget ID
Then, all messages of the control will have this class to respond. The procedure is as follows:
1. derive a class from the control of subclass, for example, from cedit-> cmyedit;
2. Complete the messages to be processed in cmyedit, such as onchar;
3. Define the member variable m_myedit of a cmyedit class in the dialog box class;
4. Add m_myedit (idc_edit, this) to oninitdialog of dialog );
In this way, when onchar occurs on idc_edit, onchar in cmyedit is called.
In addition, the behavior of replacing another process with a window process is subclassing, which is a derived subclass in the sense of windows.
The derived subclass of the image language is completely different. Subclassdlgitem allows the specified sub-user in the dialog box to control its own window process to replace the default window
Process to intercept messages.
Note: In VC, functions such as ddx_control in the dodataexchange function call subclassdlgitem to subclass the window,
In this way, the control can process messages by itself.