Cheetah mfc--Intercept Messages Setwindowslong Callwindowsproc controls do not meet our needs when adding modifications to these features

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.