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?