📄 dllfrm.pas
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -