Intercepting Windows messages

Source: Internet
Author: User

----Borland C + + Builder API Backdoor

----Intro

----C + + Builder is worthy of Borland company's excellent products, it is very fast and efficient to develop Windows programs, but in the process of programming you will find some of its limitations, so that you can not achieve their own ideas. For example, you can't change the system menu of the form, for example, you can't find the Starttrack and Endtrack events when you use the tracking bar, but your program needs both. Windows API programming, you will not have these problems, just to deal with Wm_syscommand and Wm_hscroll (or wm_vscroll) messages, you can achieve these functions. The disadvantage of the Windows API is that programming is cumbersome, and too much time is spent on detail, but its functionality is the most powerful. C + + Builder's VCL is only a subset of its functionality, because VCL is encapsulated on the basis of the API, and it discards some features that are not commonly used in encapsulation. But the programmer's imagination is not encapsulated, they are always with greater enthusiasm to achieve the ingenuity of ideas, modify the System menu and add Starttrack and Ndtrack events to the tracking column is just a trick. But VCL does not have these functions, how to do?

----Fortunately, the Borland company did not block the road, but left behind a backdoor-allowing programmers to intercept and process Windows messages themselves, just like API programming. So, the method has ...

----method

----Blocking Windows messages requires the following steps:

----inside a form header file (such as Unit1.h)

----1. Create a message mapping table in the class declaration, handing the processing of a message to a custom message handler function.

Begin_message_map

Message_handler (Windows message name, tmessage, message processing function name)

Message_handler (...)

End_message_map (Tform)

----2. Declare a message handler function within the private area of a class declaration.

Private://User declarations

void __fastcall Message handler function name (Tmessage &message);

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.