Lots of ways to skin that cat. Declare a base TPluginMessage, for example, and pass those around. Derive types from TPluginMessage that add the extra stuff you need. I don't know if Delphi has run-time type information; if it does not, TPluginMessage needs a field that indicates which derived type it really is.
So:
if (currentMessage.Type == MessageType.SongMessage)
{
TSongMessage songMessage = (TSongMessage) currentMessage;
Play(songMessage);
}
...or whatever. I haven't done much Delphi and that little bit was several years ago, so you'll have to translate some of the syntax.

Bookmarks