System.Messaging.TMessageManager.SendMessage

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure SendMessage(const Sender: TObject; AMessage: TMessage); overload; inline;
procedure SendMessage(const Sender: TObject; AMessage: TMessage; ADispose: Boolean); overload;

C++

void __fastcall SendMessage(System::TObject* const Sender, TMessageBase* AMessage)/* overload */;
void __fastcall SendMessage(System::TObject* const Sender, TMessageBase* AMessage, bool ADispose)/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Messaging.pas
System.Messaging.hpp
System.Messaging TMessageManager

Description

Sends a message to subscribers.

Using the SendMessage method, all the methods that were previously subscribed to the type of the message sent are called with that particular message as a parameter.

Example

This example creates and sends a message containing an Unicode string to the default message manager:

In Delphi:

MessageManager := TMessageManager.DefaultManager;
Message := TMessage<UnicodeString>.Create('This is a string message.');
MessageManager.SendMessage(Sender, Message, True);

In C++:

TMessageManager* MessageManager = TMessageManager::DefaultManager;
TMessage__1<UnicodeString>* Message = new TMessage__1<UnicodeString>("This is a string message.");
MessageManager->SendMessage(Sender, Message, true);

See Also