Go Up to VCL Component Writer's Guide Index
In application development, messages are a mechanism of communication between processes.
In your application, messages may come from:
- The system, which informs your application of user input, painting phases, and other system-wide events.
- Your application. Different parts of your application use messages to communicate with each other.
When to Use Messages
When you write an application, you usually handle events rather than messages. Components publish events that you can handle, and they only use messages internally (transparently for you), to communicate with other components and handle system messages.
However, you might need to use messages if:
- Your application must respond to a system or framework message that is not exposed by an event.
- You are creating a custom component. Components use messages to communicate with each other.
- You are creating a multithreaded application. Different threads may communicate with each other using messages.
Choosing a Messaging Solution
When you work on a RAD Studio project, there are two different messaging solutions that you may use. When your project is an application, you usually choose the messaging solution that your application framework uses:
- FireMonkey applications, which require a cross-platform messaging solution, use the RTL.
- VCL applications rely on the Windows API for messaging.
If you are writing a custom component, you may use the cross-platform RTL messaging system regardless of the framework that your component uses, FireMonkey or VCL. However, using the Windows API messaging solution on VCL components might be wiser, as existing VCL components only receive and send messages using the Windows API, and the VCL framework does not translate Windows API messages into cross-platform messages as FireMonkey does.