二个DLL都是有窗体的,谢谢解答!!!!!!!!

解决方案 »

  1.   

    怎么在主程序时里调用的就怎么在DLL里面调用
      

  2.   

    在DLL中调用与在程序中调用相同
      

  3.   

    一样的呀,下面是passform.dll文件一段代码,希望能又帮助://载入窗体
    procedure LoadForm ;
    var
      GetPasswordForm: TGetPasswordForm;
    begin
      GetPasswordForm := TGetPasswordForm.Create(Application);
      GetPasswordForm.ShowModal;
    end;//设置密码
    procedure TGetPasswordForm.SetBtnClick(Sender: TObject);
    begin
       ghandle := LoadLibrary('UserFrm.dll');
       myfunc := GetProcAddress(ghandle, 'GetForm');   if TGetForm(myfunc)(gUserName, gPassword) = False then
           MessageDlg('设置密码失败', mtInformation, [mbok], 0);
       freelibrary(ghandle);
    end;
      

  4.   

    调用方法与在APPLICATION中是一样的方法
      

  5.   

    对,完全一样。
    你可以动态(LoadLibrary)也可以静态调用。
      

  6.   

    uses Windows, ...;
    type  TTimeRec = record
        Second: Integer;
        Minute: Integer;
        Hour: Integer;
      end;  TGetTime = procedure(var Time: TTimeRec);  THandle = Integer;var  Time: TTimeRec;
      Handle: THandle;
      GetTime: TGetTime;
      ...
    begin
      Handle := LoadLibrary('DATETIME.DLL');
      if Handle <> 0 then
      begin
        @GetTime := GetProcAddress(Handle, 'GetTime');
        if @GetTime <> nil then
        begin
          GetTime(Time);
          with Time do
            WriteLn('The time is ', Hour, ':', Minute, ':', Second);
        end;
        FreeLibrary(Handle);
      end;end;
      

  7.   

    function ShowAbc(AHandle: THandle; ACaption: String):BOOL; StdCall;function ShowAbc(AHandle: THandle; ACaption: String):BOOL;
    var
     AaaForm : TAaaForm;
    begin
     Application.Handle := AHandle;
     AaaForm := TAaaForm.Create(Application);
     try
       AaaForm.Caption := ACaption;
       AaaForm.ShowModal;
       Result := False; 
     finally
       AaaForm.Free;
     end;
    End;Var
      LibHandle: THandle;
      ShowAbc: TShowAbc;
    begin
      LibHandle := LoadLibrary('Cde.dll');
      try
        if LibHandle = 0 then
        @ShowAbc := GetProcAddress(LibHandle, 'ShowAbc');
        if not (@ShowAbc = nil) then
          ShowAbc(Application.Handle, '测试')
        else
          RaiseLastWin32Error;
      finally
        FreeLibrary(LibHandle);
      end;
    //以上代码在Application中编译是正确的,但在DLL中会报好多的错误:(
      

  8.   

    和普通的Exe一样的方法就是了