Deep VCL understanding of BCB message mechanism 3

Source: Internet
Author: User
Tags exception handling

Method 3 method from Tapplication

Needless to my nonsense, we all know the importance of tapplication in the BCB. In BCB's help: Tapplication, Tscreen and Tform form the backbone of all BCB-style Win32 GUI programs that control the behavior of your programs. The Tapplication class provides properties and methods that encapsulate the behavior of standard Windows programs. Tapplication shows the rationale for creating, running, supporting, and destroying applications in the Windows operating system. As a result, tapplication greatly simplifies the interface between developers and Windows environments. This is precisely the rad nature of BCB.

The standard Windows behavior of the Tapplication package roughly includes the following sections:

1> Windows Message Processing

2> online Help for contextual associations

Shortcut keys and keyboard event handling for the 3> menu

4> Exception Handling

5> manages the basic parts of the program defined by the operating system, such as MainWindow main window, Windowclass window class, and so on.

In general, BCB automatically generates an instance of the Tapplication class for each program. This part of the source code can be seen in the Yourproject.cpp file (this assumes that your project name is called YOURPROJECT.BPR).

Of course tapplication is not visible, he is always behind your form silently control the behavior of your program. But it's not that you can't find any clues. If you create a new program (new application), and then make no changes, compile and run, you will find that the caption of the program form is Form1, but the caption on the status bar of Windows does write the words Project1. This is evidence of the existence of tapplication. Of course, this is only a conjecture, the actual combat method should open BCB with the winsight to view the process of the system. You can clearly see the existence of the Tapplication class, his size is 0 (hidden), then the TForm1 class.

Well, now that tapplication encapsulates the content of the message processing. Let's look at the actual action of tapplication. In fact, when the message arrives at the BCB program, the Tapplication object is the first to get them. Passed to the form after tapplication. The previous approach was a way to overload Tform, obviously a bit later than the method mentioned in this article. Do you want to get the message and deal with them the first time?

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.