如何将DLL文件附加到主程序中的一个控件TabSheet1中成为一部分
就像一个程序中有多个功能,但是这个是分离的,必须加载那个DLL
文件后,TabSheet1中才能有相应的功能:
主程序main.exe 有控件RzPageControl1,内有TabSheet1--TabSheet6
窗体库文件STUDGLS.dll嵌入一个TabSheet1显示,选用TabSheet1项再调用
STUDGLS.dll并能完成相关独立的基本操作》》》》》》》》》》

解决方案 »

  1.   

    运行该dll,显示其中的窗体,取得它的句柄
    把它的parent设置为此tabsheet,大小、位置正好充满
      

  2.   

    取得DLL中窗体的句柄,然后用SetParent来把TabSheet设为父窗体。
      

  3.   

    楼主,这个问题我也研究了数月,最终还是没搞定,我以前直接把form做在dll中做窗口是可以,现在在做一个项目,想把frame或form放在dll中,调用到Tabsheet,一直有报错,查询资料无数,最终还是绝望了,现在做bpl解决了,如果楼主获得答案了记得通知一声,万分感谢,[email protected].
      

  4.   

    我把别的exe的form(无论是不是delphi写的)拉到自己exe里的panel里都可以啊
      

  5.   

    DLL的输出函数里创建窗体,并把窗体的parent值付为tabsheet就可以啦主调用部分---------
    unit Unitmain;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        btn1: TButton;
        Panel1: TPanel;
        procedure btn1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      procedure synapp(app:THandle);stdcall;external 'mydll.dll';
      function showform(app:THandle):TForm;stdcall;external 'mydll.dll';
    implementation
    uses Math;{$R *.dfm}procedure TForm1.btn1Click(Sender: TObject);
    var
      tmpform:Tform;
    begin
      synapp(Application.Handle);
      tmpform:=showform(Panel1.Handle);
    end;end.DLL部分----------------
    library mydll;{ Important note about DLL memory management: ShareMem must be the
      first unit in your library's USES clause AND your project's (select
      Project-View Source) USES clause if your DLL exports any procedures or
      functions that pass strings as parameters or function results. This
      applies to all strings passed to and from your DLL--even those that
      are nested in records and classes. ShareMem is the interface unit to
      the BORLNDMM.DLL shared memory manager, which must be deployed along
      with your DLL. To avoid using BORLNDMM.DLL, pass string information
      using PChar or ShortString parameters. }uses
      SysUtils,
      Classes,
      Unit1 in 'Unit1.pas' {Form1};{$R *.res}
    exports
    synapp,showform;       //输出的函数
    begin
    end.
    DLL里窗体部份-----------------也就是输出函数的实现
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs,StdCtrls;type
      TForm1 = class(TForm)
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      procedure synapp(app:THandle);stdcall;
      function showform(app:THandle):TForm;stdcall;implementation
    uses Math;{$R *.dfm}
    procedure synapp(app:THandle);stdcall;
    begin
      Application.Handle:=app;
    end;function showform(app:THandle):TForm;stdcall;
    begin
      Form1:=TForm1.Create(Application);
      Form1.ParentWindow := app;
      Form1.Height:=100;
      Form1.Width :=100;
    //  Form1.Align :=alClient;
      Result:=Form1;
      Form1.Show;
    end;
    end.
      

  6.   

    刚才想发一下代码,发不成功,只DLL的输出函数里,传一个参数(TabSheet),在DLL创建窗体时,把窗体的parent付值(TabSheet)就可以啦
      

  7.   

    你好,我想问一下,要是用BPL如何实现,这个BPL是如何编写,能否也提供一些相关资料给我谢谢
    请你发一些DEMO程序到谢谢
      

  8.   

    还请多多赐教,
    请你发一些DEMO程序到谢谢