Broadcast message within the application

The VCL provides a elegant way via the 'Broadcast' method from TWinControl
to notify all the classes in an application. A control must implement an
eventhandler to react on the message. If you want to stop the message, just
return 0 in 'Message.Result'.

var i: integer;
    hMessage: TMessage;
begin
  hMessage.Msg := WM_USER + 1;
  hMessage.WParam := 0;
  hMessage.LParam := 0;
  for i := 0 to Screen.FormCount-1 do
    Screen.Forms[i].Broadcast(hMessage);
end;
The class TScreen holds all forms within an application. The Eventhandler
may look like this:
TMyButton = class(TButton)
  protected
    procedure EventHandler(var Message: TMessage); message WM_USER + 1;
  end;
.
procedure TMyButton.EventHandler(var Message: TMessage);
begin
  // commands
  Message.Result := 0; // Event continues
end;