procedure TForm1.Test(var msg: tagMsg; var H: boolean);
begin
//if (Msg.hwnd = Handle) or (FindControl(Msg.hwnd)<>nil) then
if (Msg.message = WM_LButtonDown) or (Msg.message = WM_NCLBUTTONDOWN) then
Caption := Format('%d,%d',[mouse.CursorPos.X, mouse.CursorPos.Y]);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnMessage := Test;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(self.Caption);//测试:先响应OnMessage后,消息才分派到BtnOnclick
end;