pluginsfrm.pas
来自「《delphi深度编程及其项目开发》」· PAS 代码 · 共 54 行
PAS
54 行
unit pluginsfrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmPlugins = class(TForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
//定义ShowDLLForm,用于打开本窗体
function ShowDLLForm(AHandle: THandle; ACaption: string): Boolean; Stdcall;
//输出标题
function GetCaption: Pchar; stdcall;
implementation
{$R *.dfm}
//输出标题
function GetCaption: Pchar; stdcall;
begin
Result := '插件演示NO1';
end;
//打开本窗体
function ShowDLLForm(AHandle: THandle; ACaption: string): Boolean;
var
DLL_Form: TfrmPlugins;
begin
result := true;
try
application.Handle := AHandle; //传递应用程序地址
DLL_Form := TFrmPlugins.Create(Application);//创建窗体
try
DLL_Form.caption := Acaption;//给窗体标题赋值
DLL_Form.ShowModal; //模式显示窗体
finally
DLL_Form.Free;
end;
except
result := false;
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?