消息的拦截可以在Application.OnMessage中进行,至于你的要求可能不是几句话能搞定的。给一个Application.OnMessage的例子吧。也是帮助文档中的例子:
const
WM_FILEREADY = WM_USER + 2000;
procedure TForm1.FormCreate(Sender: TObject);begin
Application.OnMessage := AppMessage;
end;procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
if Msg.message = WM_FILEREADY then
begin
Memo1.Lines.LoadFromFile(StrPas(PChar(Msg.lParam)));
Handled := True; end; { for all other messages, Handled remains False }
{ so that other message handlers can respond }
end;
const
WM_FILEREADY = WM_USER + 2000;
procedure TForm1.FormCreate(Sender: TObject);begin
Application.OnMessage := AppMessage;
end;procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
if Msg.message = WM_FILEREADY then
begin
Memo1.Lines.LoadFromFile(StrPas(PChar(Msg.lParam)));
Handled := True; end; { for all other messages, Handled remains False }
{ so that other message handlers can respond }
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货