获得 MDI 窗体创建和释放的方法
来源:互联网 发布:linux集群架构 编辑:程序博客网 时间:2024/06/06 02:13
var wc:TWinControl;begin // Hook 到消息,有某个MDI窗体被关闭了。 case Msg.Msg of WM_MDICreate:begin FDuoLog.LogIt('MDI Create : ' + IntToStr(Msg.LParam) + ',' + IntToStr(Msg.WParam)); end; WM_MDIDestroy:begin FDuoLog.LogIt('MDI Destroy : ' + IntToStr(Msg.LParam) + ',' + IntToStr(Msg.WParam)); end; WM_PARENTNOTIFY:begin case Msg.WParamLo of WM_CREATE:begin wc := FindControl(Msg.LParam); // LParam = Form.Handle if (wc <> nil) and (wc is TForm) then FDuoLog.LogItFormat('窗体 "%s" 创建。',[TForm(wc).Caption]); end; WM_DESTROY:begin wc := FindControl(Msg.LParam); // LParam = Form.Handle if (wc <> nil) and (wc is TForm) then FDuoLog.LogItFormat('窗体 "%s" 释放。',[TForm(wc).Caption]); end; end; end; end;end;