参考:library MyDll;uses SysUtils, Classes, Main in 'Main.pas' {Form1};{$R *.res}procedure ShowForm; begin Form1:=TForm1.Create(nil); Form1.ShowModal; Form1.Free; end;exports ShowForm;beginend.program MyApp;{$APPTYPE CONSOLE}uses Windows;type TShowForm = procedure;var hModule: Cardinal; ShowForm: TShowForm; begin hModule:=LoadLibrary('MyDll.dll'); if hModule<>0 then begin ShowForm:=GetProcAddress(hModule, 'ShowForm'); if Assigned(ShowForm) then ShowForm; FreeLibrary(hModule); end; end.
SysUtils,
Classes,
Main in 'Main.pas' {Form1};{$R *.res}procedure ShowForm;
begin
Form1:=TForm1.Create(nil);
Form1.ShowModal;
Form1.Free;
end;exports
ShowForm;beginend.program MyApp;{$APPTYPE CONSOLE}uses
Windows;type
TShowForm = procedure;var
hModule: Cardinal;
ShowForm: TShowForm;
begin
hModule:=LoadLibrary('MyDll.dll');
if hModule<>0 then
begin
ShowForm:=GetProcAddress(hModule, 'ShowForm');
if Assigned(ShowForm) then
ShowForm;
FreeLibrary(hModule);
end;
end.