var pMes:^String; begin New(pMes); pMes^:=msg; PostMessage(Application.handle, WM_Custom, 0, Integer(pMes)); end;
以下是接收
procedure CustomMessages(var Msg: TMsg; var Handled: Boolean);
var
msgStr: String;
pMes:^String;
begin
if Msg.hwnd = Application.handle then
begin
case Msg.message of
WM_Custom:
begin
pMes:=Pointer(Msg.LParam);
msgStr:=pMes^;
Dispose(pMes);
showmessage(msgStr);
Handled := True;
end;
else
end;
end;
end;