What does the OnMessage Event in DelphiVCL.Application do?
By Muhammad Azizul Hakim January 24, 2022
In Для просмотра ссылки Войдиили Зарегистрируйся the OnMessage or DelphiVCL.Application.OnMessage occurs when the application receives a message from either the Windows operating system or another application.
Note: OnMessage only receives messages that are posted to the message queue, not those sent directly with the Windows API SendMessage function.
Caution: Thousands of messages per second flow through this event. Be careful when coding the handler, because it can affect the performance of the entire application.
Note: You can also respond to this event using the TApplicationEvents component, which allows you to assign an event handler using the IDE.
See the responses in our Windows command prompt:
You can also read short information about the DelphiVCL.Application.OnMessage using the print() command:
See the responses in our Windows command prompt:
By Muhammad Azizul Hakim January 24, 2022
In Для просмотра ссылки Войди
How to use the DelphiVCL.Application.OnMessage event properly?
We use the OnMessage to trap any or all Windows messages posted to all windows in the application. The OnMessage event occurs when an application receives a Windows message. An OnMessage event handler allows an application to respond to messages other than those declared in the events for TApplication. If the application does not have a specific handler for an incoming message, the message is dispatched to the window for which it was intended, and Windows handles the message.Note: OnMessage only receives messages that are posted to the message queue, not those sent directly with the Windows API SendMessage function.
Caution: Thousands of messages per second flow through this event. Be careful when coding the handler, because it can affect the performance of the entire application.
Note: You can also respond to this event using the TApplicationEvents component, which allows you to assign an event handler using the IDE.
How do I examine the properties and methods of the DelphiVCL.Application.OnMessage event?
Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Application.OnMessage using the dir() command:
Python:
import DelphiVCL
dir(DelphiVCL.Application.OnMessage)
You can also read short information about the DelphiVCL.Application.OnMessage using the print() command:
Python:
print(DelphiVCL.Application.OnMessage)
print(DelphiVCL.Application.OnMessage.__doc__)