Modifying an existing control's function--Subclass technology You can enter only characters and not other types----------------intercept messages two functions Setwindowslong () Callwindowsproc () The small controls below are a small window
is the window has its own window process, you can give it a new frontal window process to replace the original window process, with a new window process his message, that is, the original message interception, with a new window process to deal with
To add a C + + class after modifying the ID:
Declaring a function in a new class
Include the header file of the new class in the main file and declare the global variables:
In the Initialization dialog box, associate the new window (that is, the text box) handle with the class:
Defining new variables and declaring window procedures: format for Windows requirements
Implement the new attach function:
Define new Window Procedure property constants:
The new window procedure goes to call the old window procedure:
Here is the interception message:
To add a delete message:
Add a function to the new declaration: Implement the function:
decimal point processing:
Minus sign Processing:
Increase robustness If you do not go to invoke the default window procedure ":
Only the input array minus the decimal point cannot be entered: Double-click the Read button:
To add a member function:
Implement the function:
As a result of the error, the modified function is as follows:
In the handler function after the button double-click the following ":
To add a cancellation function declaration:
Replace the window procedure of the text box with the old window procedure
Called in the destructor:
The second method is called when the dialog box is destroyed: "
From for notes (Wiz)
Cheetah mfc--Intercept Messages Setwindowslong Callwindowsproc controls do not meet our needs when adding modifications to these features