简单的任务: 我想制作一个程序(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;
最佳答案
按照您的设置方式,程序会在加载时查找 DLL。您需要的是将 DLL 设置为插件。看看JVCL中的JVPlugin框架。它正是您正在寻找的东西。
关于delphi - Dll 能为主程序提供模块化吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1974913/