一个窗体是经常用到的!我想把它放在DLL,这样行吗?!怎么去实现!

解决方案 »

  1.   

    如果有类似的例子!可提供一个!谢谢!
    [email protected]
      

  2.   

    form上点右键,saveto repository
      

  3.   

    library templete;{ 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
      ShareMem,
      SysUtils,
      windows,
      Classes,
      test in 'test.pas' {frmTest},
      Date1 in 'Date1.pas' {frmDate1},
      Pub in 'Pub.pas',
      Date2 in 'Date2.pas' {frmDate2};{$R *.res}
    {$E plg.}function test(HICON :Hicon) : Boolean; stdcall;
    var frm : TFrmTest;
    begin
      Result := False;
      IconHandle := HICON;
      frm := TFrmTest.Create(nil);
      try
        frm.Icon.Handle := HICON;
        frm.Go;
      finally
        frm.Free;
      end;
      result := true;
    end;function GetDate1(var Date1 : TDateTime) : Boolean; stdcall;
    var frmDate1 : TfrmDate1;
    begin
      Result := False;
      try
        frmDate1 := TfrmDate1.Create(nil);
        frmDate1.ShowModal;
      finally
        frmDate1.Free;
      end;
      Date1 := Pub.Date1;
      Result := True;
    end;function GetDate2(var Date1 : TDateTime; var Date2 : TDateTime) : Boolean; stdcall;
    var frmDate2 : TfrmDate2;
    begin
      Result := False;
      try
        frmDate2 := TfrmDate2.Create(nil);
        frmDate2.ShowModal;
      finally
        frmDate2.Free;
      end;
      Date1 := Pub.Date1;
      Date2 := Pub.Date2;
      Result := True;
    end;
    exports
      test,
      GetDate1,
      GetDate2;
    beginend.
    这个是我写的一个插件,呵呵,DLL基本上就是这个样子。
      

  4.   

    DLL有这样的功能么?是不是在直接其中增加一个Form,就可以呢?那在exports部份应该怎么写!
      

  5.   

    和普通工程没有什么区别
    唯一的区别就是需要动态创建窗体。
    exprots是导出的过程,过程要用stdcall
      

  6.   

    楼上老兄:动态创建窗体,这个不难,关键是Form上的控件呢?