Using the RTL Cross-Platform Messaging Solution
Sending and Receiving Messages
The RTL cross-platform messaging solution is based on a message manager:
- Components that want to receive messages of a a certain type subscribe to the target message type on the message manager.
- Components send messages to the message manager, which relays those messages to components subscribed to the type of the received message.
For more information, see Sending and Receiving Messages Using the RTL.
RAD Studio Frameworks Support for RTL Messages
FireMonkey Support for RTL Messages
FireMonkey provides a platform service, IFMXApplicationService, that provides cross-platform access to event notifications so that you do not need to use a different, platform-specific event system on each platform that your application targets. When
IFMXApplicationService receives an event notification from the operating system, it generates a message object (TMessage or one of its descendants) to provide the event data. The message object contains read-only information about the event that occurred. The type of the message object indicates the type of event that occurred.
FireMonkey components also rely on RTL messages to communicate with each other.
VCL Support for RTL Messages
The VCL framework does not use RTL cross-platform messaging solution; instead, it uses the Windows API messaging solution. This means that the VCL does not translate Windows messages into RTL messages for you, and VCL components communicate with each other using the Windows API as well.
You can use RTL messages in your project only if you do not need to capture the messages from Windows or VCL components. For example, you may use RTL messages to handle threads in a multi-threaded application or to write components that only send and receive messages from each other.
If you need access to messages from Windows or VCL components, you must do either of the following:
- Use the Windows API messaging solution.
- Port your project to FireMonkey. FireMonkey already translates system messages into RTL messages, and FireMonkey components use RTL messages as well.
- Write your own translation layer that maps Windows API messages to RTL messages.