Dll可以为主程序提供模块化吗?

lyb*_*rko 1 delphi vcl

简单的任务:我想制作一个程序(parent.exe).有三个按钮.当我单击Button1时,出现Form1; 按钮2,Form2出现时; 当Button3,Form3出现时......

Form1,Form2,Form3存储在三个不同的dll(Form1dll.dll,Form2dll.dll,Form3dll.dll)中.

我想让父程序(parent.exe)运行模块化.我计划添加和删除dll,但Parent.exe要求所有dll都存在,否则会发生异常.

我该如何解决这个问题?

感谢名单

这是来自parent.exe的代码:

  procedure ShowForm1;stdcall;external 'Project1dll.dll' name 'ShowForm1';
  procedure ShowForm2;stdcall;external 'Project2.dll' name 'ShowForm2';
  procedure ShowForm3;stdcall;external 'Project3.dll' name 'ShowForm3';

var
  ParentForm: TParentForm;

implementation

{$R *.DFM}



procedure TParentForm.Button1Click(Sender: TObject);
begin
  ShowForm1;
end;

procedure TParentForm.Button2Click(Sender: TObject);
begin
  ShowForm2;
end;

procedure TParentForm.Button3Click(Sender: TObject);
begin
  ShowForm3;
end;
Run Code Online (Sandbox Code Playgroud)

Mas*_*ler 5

你设置它的方式,程序在加载时查找DLL.你需要的是将DLL设置为插件.看一下JVCL中的JVPlugin框架.它正是您正在寻找的.