📄 testdll.pas
字号:
unit TestDLL;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, DB, ExtCtrls, DBTables;
type
TShowForm = function(A: TApplication): Bool; StdCall;
EDLLLoadError = class(Exception);
TfrmCallDLL = class(TForm)
Database1: TDatabase;
btnCallDLL: TButton;
btnClose: TButton;
procedure btnCallDLLClick(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
end;
var
frmCallDLL: TfrmCallDLL;
implementation
{$R *.DFM}
procedure TfrmCallDLL.btnCallDLLClick(Sender: TObject);
var
LibHandle: THandle;
ShowForm: TShowForm;
begin
LibHandle := LoadLibrary('RptDLL.DLL');
try
if LibHandle = HINSTANCE_ERROR then
raise EDLLLoadError.Create('Unable to Load DLL');
@ShowForm := GetProcAddress(LibHandle, 'ShowForm');
if not (@ShowForm = nil) then
ShowForm(Application);
finally
FreeLibrary(LibHandle);
end;
end;
procedure TfrmCallDLL.btnCloseClick(Sender: TObject);
begin
Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -