#include#include void SendMessage(BMessenger target) { BMessage message(MSG_HELLO); message.AddMessenger("messenger", target); /* send the message */ }
#includeIn this example, we receive a BMessage object that has a messenger attached to it. We use the FindMessenger function to retrieve the messenger object and store it in a BMessenger variable. We can then use this object to send a reply message or perform some other action. The BMessage and BMessenger classes are part of the BeOS/Haiku operating system package libraries.#include void ReceiveMessage(BMessage message) { BMessenger sender; message.FindMessenger("messenger", &sender); /* do something with the sender */ }