自己初学delphi的DLL,写了一个简单的调用窗体dll不知道哪里的问题,总是出错,请大家指导下
DLL中的代码
library mydll;uses
  SysUtils,
  Forms,
  Windows,
  Messages,
  Classes,
  Unit1 in 'Unit1.pas' {Form1};{$R *.res}var
  DLLApp: TApplication;
  DLLScr: TScreen;
function CreateDLLForm(App: TApplication; Scr: TScreen): TForm;
begin
  Application := App;
  Screen := Scr;
  Application.CreateForm(TForm1, Form1);
  result := Form1;
end;exports
  CreateDLLForm;begin
  DLLApp := Application;
  DLLScr := Screen;
end.有一个uint1单元的Form1窗体,上面一个就一个按钮
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}end.//我在程序中调用这个窗体,程序如下:
program Project1;uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};{$R *.res}begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  InvokeDLLForm = function(App: TApplication; Scr: TScreen): TForm;
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  DLLForm: TForm;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
  DLLHandle: THandle;
  DLLSub: InvokeDLLForm;
begin
  DLLHandle := LoadLibrary('mydll.dll');
  @DLLSub := GetProcAddress(DLLHandle,'CreateDLLForm');
  DLLForm := DLLSub(Application, Screen);
end;end.
怎么调用时总有错!是哪里的问题!