procedure MyDllProc(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then //退出时恢复Dll的Application
begin
if Assigned(DllApp) then
Application := DllApp;
end;
end;
function returnClass(AppHandle: Integer): TForm ;stdcall; export;
var frm:TMyForm;//自己在dll中加一个form单元
begin
if not Assigned(DllApp) then
begin
DllApp := Application;
Application.handle := AppHandle;
end;
frm := TFrmTMDC.Create(application);
result := frm;
//frm.ShowModal;
end;
exports
returnClass; //输出函数
begin
DllProc := @MyDllProc;
end.