⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d6mdimsgfix.pas

📁 Jedi Code Library JCL JVCL 组件包 JCL+JVCL超过300个组件的非可视/可视大型组件包。
💻 PAS
字号:
unit D6MdiMsgFix;

interface

{$I jcl.inc}

implementation

{$IFDEF DELPHI6}

uses
  Windows, Classes, SysUtils, Forms, AppEvnts;

type
  TFixApplicationEvents = class(TCustomApplicationEvents)
  protected
    procedure ApplicationEventsMessage(var Msg: TMsg; var Handled: Boolean);
  public
    constructor Create(AOwner: TComponent); override;
  end;

  TApplicationAccess = class(TApplication);

var
  FixApplicationEvents: TFixApplicationEvents;

{ TFixApplicationEvents }

procedure TFixApplicationEvents.ApplicationEventsMessage(var Msg: TMsg; var Handled: Boolean);
begin
  with Application do
    if Assigned(MainForm) and (MainForm.FormStyle = fsMDIForm) and
      Assigned(Screen.ActiveForm) and (Screen.ActiveForm.FormStyle <> fsMdiChild) then
      begin
        Handled := True;
        with TApplicationAccess(Application) do
          if not IsKeyMsg(Msg) and not IsDlgMsg(Msg) then
          begin
            // prevent to call buggy TApplication.IsMDIMsg method, handle message here
            TranslateMessage(Msg);
            DispatchMessage(Msg);
          end;
      end;
end;

constructor TFixApplicationEvents.Create(AOwner: TComponent);
begin
  inherited;
  OnMessage := ApplicationEventsMessage;
end;

initialization
  FixApplicationEvents := TFixApplicationEvents.Create(nil);

finalization
  FreeAndNil(FixApplicationEvents);

{$ENDIF DELPHI6}

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -