dllfrm.pas

来自「《delphi深度编程及其项目开发》」· PAS 代码 · 共 49 行

PAS
49
字号
unit DLLFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TfrmDLL = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;

{声明要引出的方法}
procedure ShowDLLModalForm(aHandle: THandle); stdcall; //模式显示窗口
procedure ShowDLLForm(aHandle: THandle); stdcall; //非模式显示窗口

implementation

{$R *.dfm}

//模式显示窗口
procedure ShowDLLModalForm(aHandle: THandle);
begin
  Application.Handle := aHandle; //传递应用程序句柄
  with TfrmDLL.Create(Application) do //创建窗体
  begin
    try
      ShowModal; //模式显示窗体
    finally
      free;
    end;
  end;
end;


//非模式显示窗口
procedure ShowDLLForm(aHandle: THandle);
begin
  Application.Handle := aHandle; //传递应用程序句柄
  with TfrmDLL.Create(application) do //创建窗体
    Show; //非模式显示窗体
end;
end.

⌨️ 快捷键说明

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