dllfrm.pas
来自「Java实例入门」· PAS 代码 · 共 42 行
PAS
42 行
unit DLLFrm;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, Grids, Calendar;
type
TDLLForm = class(TForm)
calDllCalendar: TCalendar;
end;
{ 声明输出函数}
function ShowCalendar(AHandle: THandle; ACaption: String): Longint; stdCall;
procedure CloseCalendar(AFormRef: Longint); stdcall;
implementation
{$R *.DFM}
function ShowCalendar(AHandle: THandle; ACaption: String): Longint;
var
DLLForm: TDllForm;
begin
// 复制应用程序的句柄给DLL的TApplication对象
Application.Handle := AHandle;
DLLForm := TDLLForm.Create(Application); //创建窗体
Result := Longint(DLLForm);
DLLForm.Caption := ACaption;
DLLForm.Show; //显示窗体
end;
procedure CloseCalendar(AFormRef: Longint);
begin
if AFormRef > 0 then //如果引用有效,则释放窗体
TDLLForm(AFormRef).Release;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?