//Tform1是你要显示的Form
const
WM_ActiveApplication= WM_USER+1410;
procedure MsgHandler(var Msg: TMsg
var Handled: Boolean);
procedure WMActiveApplication(var aMsg: TMessage);message WM_ActiveApplication;
procedure Tform1.MsgHandler(var Msg: TMsg
var Handled: Boolean);
begin
//处理点击IE窗口关闭按钮消息
if Msg.Message = WM_CLOSE then
begin
handled:=System.false;
Application.Terminate;
end;
end;
procedure Tform1.FormShow(Sender: TObject);
begin
PostMessage(self.Handle,WM_ActiveApplication,0,0);
end;
procedure Tform1.WMActiveApplication(var aMsg: TMessage);
begin
Application.Initialize;
Application.OnMessage := MsgHandler;
Application.Run;
end;