急问!谢谢大家!

解决方案 »

  1.   

    无模式窗体直接show就可以,
    有模式的要传当前窗口的handle.
      

  2.   

    library Project1;{ 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
      Forms,
      SysUtils,
      Classes,
      Unit1 in 'Unit1.pas' {Form1};{$R *.res}
    procedure ShowMainForm;
    var
      frm : TForm1;
    begin
      frm := TForm1.Create(Application);
      frm.ShowModal;
      frm.Free;
    end;
    exports
      ShowMainForm;
    begin
    end.
    //////////////
    unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm2 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
      procedure ShowMainForm; stdcall;
    var
      Form2: TForm2;implementation{$R *.dfm}
    procedure ShowMainForm;external 'Project1.dll';procedure TForm2.Button1Click(Sender: TObject);
    begin
      ShowMainForm;
    end;end.
      

  3.   

    library Project1;{ 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
      Forms,
      SysUtils,
      Classes,
      Unit1 in 'Unit1.pas' {Form1};{$R *.res}
    procedure ShowMainForm;
    var
      frm : TForm1;
    begin
      frm := TForm1.Create(Application);
      frm.ShowModal;
      frm.Free;
    end;
    exports
      ShowMainForm;
    begin
    end.这样创建的话,任务栏会出现另外的窗体,但我想要DLL的窗体是EXE的子窗体哦
      

  4.   

    lijinghe1(副乡长)
    请问怎样创建模式窗体?
    我传递了Handle,但是执行DLL的Application.Handle := h;//(传递进DLL的EXE窗体句丙)
    后,Application.Handle还是为0,窗体创建失败,报错哦
      

  5.   

    procedure ShowMainForm(h :THandle);
    var
      frm : TForm1;
    begin
      application.handle := h;
      frm := TForm1.Create(Application);
      frm.ShowModal;
      frm.Free;
    end;
    调用  ShowMainForm(handle);
      

  6.   

    lijinghe1(副乡长)Application.handle 是QApplicationH的类型哦,application.handle := h会类型不匹配的!我试了很多次了,试过把TApplication传过去,但到了ShowMainForm就成了nil了,救命啊!!
      

  7.   

    ShowMainForm(h :Hwnd);
    application.handle:=h;
    form1.showmodal;showmainform(application.handle);
      

  8.   

    你不能用
    Handle:=loadlibrary('路径');

    freelibrary();
      

  9.   

    应该不是很难吧?
    只要保证在DLL里创建FORM就可以了呀?
    我还是用DELPHI做的DLL,VC里调用的....(不过那也只是测试)
    不过代码在我家.......