procedure ShowMDIChildForm(MainApp:TApplication);
var
Child:TMDIForm;
begin
if not Assigned(SaveDllApp) then
begin
SaveDllApp:=Application;
Application:=MainApp;
end;
Child:=TMDIForm.Create(Application.MainForm);
Child.Show;
end;
procedure MyLibraryProc(Reason:integer);
begin
if Reason=DLL_PROCESS_DETACH then
if Assinged(SaveDllApp) then
Application:=SaveDllApp;
end;
export ShowMDIChildForm;
begin
DllProc:=@MyLibraryProc;
end.
在调用dll的应用中,用下述方法生MDI窗体;
procedure Form1.Button1Click(Sender:Tobject);
begin
ShowMDIChildForm(Application);
end;