He visto esto en la web de Tory:
http://www.swissdelphicenter.ch/torr...ode.php?id=418
Código Delphi
[-]
type
TWMMYMessage = record
Msg: Cardinal; Handle: HWND; Info: Longint; Result: Longint;
end;
TForm1 = class(TForm)
...public
...procedure DefaultHandler(var Message); override;
procedure WMMYMessage(var Msg: TWMMYMessage);
...end;
var
WM_OURMESSAGE: DWORD;
procedure TForm1.DefaultHandler(var Message);
var
ee: TWMMYMessage;
begin
with TMessage(Message) do
begin
if (Msg = WM_OURMESSAGE) then
begin
ee.Msg := Msg;
ee.Handle := wParam;
ee.Info := lParam;
if ee.Handle <> Handle then
WMMYMessage(ee);
end
else
inherited DefaultHandler(Message);
end;
end;
procedure TForm1.WMMYMessage(var Msg: TWMMYMessage);
begin
label1.Caption := Format('Our another form handle :%d', [Msg.Handle]);
Label2.Caption := Format('Our another form top :%d', [Msg.Info]);
end;
initialization
WM_OURMESSAGE := RegisterWindowMessage('Our broadcast message');
procedure TForm1.Button1Click(Sender: TObject);
begin
SendMessage(HWND_BROADCAST, WM_OURMESSAGE, Handle, Top);
end;