我想将一个mdi子窗体封入DLL然后在mdi主窗体中调用!!
dll side:
   exports showform;
..........
   procedure showform(a:thandle);stdcall;
.................
procedure showform(a:thandle)
var form1:tform1;
begin
  application.handle:=a;
  form1:=tform1.create(application);
  form1.showmodal;
end; main process side:
type bb=procedure(a:thandle);
procedure  onbuttonclick(sender;tobject)
var
  ins:thandle;
  dllin:bb;
begin
  ins:=loadlibary('d:\mydll.dll');
  @dllin:=getprocaddress(ins,'showform');
  dllin(application.handle);
  freelibray(ins);  
end;
提示:access the involide address;....

解决方案 »

  1.   

    你可以这样实现://dll side
    Function showform(app:TApplication): TForm; stdcall;
    var form1:tform1;
    begin
      application:=app;
      form1:=tform1.create(Application.MainForm);
      Result:=form1;
    end; //main process side
    procedure  onbuttonclick(sender;tobject)
    var
      ins:thandle;
      dllin:bb;
      frm: TForm;
    begin
      ins:=loadlibary('d:\mydll.dll');
      @dllin:=getprocaddress(ins,'showform');
      frm:=dllin(application);
      frm.ParentWindow:=frmMain.Handle;
      frm.FormStyle:=fsMDIChild;
      frm.show;  
    end;