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;
获得 MDI 窗体创建和释放的方法
最新推荐文章于 2017-09-11 22:16:33 发布