Once you have defined your message types, you'll need to create messages and give them to an entity that will take care of passing them to the current subscribers. This entity is called TMessageManager and the RTL has a singleton instance acting as the default manager. Most of the time, I tend to use the default manager to drive my custom messages too; however, you are free to define and instantiate your own TMessageManager instance (or instance of a descendant class you may want to define).
TMessageManager exposes two relevant methods—SendMessage and SubscribeToMessage.
In this section, we'll focus on the SendMessage method and, in the next section, we'll have a close look at the latter.
The SendMessage method will add a new message to the dispatching system. Actually there is not a queue of messages, that is, the mechanism is synchronous. So when you send a message, what you are actually doing is asking the dispatching...