System.Messaging.TMessageManager.SendMessage

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

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, TMessage* AMessage)/* overload */;
void __fastcall SendMessage(System::TObject* const Sender, TMessage* 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 Object Pascal:

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