通过动态联接库打开一个窗口,为何只能ShowModal才能释放FreeLibrary(DLLHandle),否则释放不成功,提示错误操作。高分请教!!!

解决方案 »

  1.   

    //*******************************************************************************
    // 描    述:动态输入
    // Input   :(窗体句柄,输入ID)
    // Output  :
    // 作    者:卢华令
    // 创建日期:2005-1-30
    // 更新日期:
    //*******************************************************************************
    procedure ActInput(iHandle:THandle;iActInputID:integer);
    type
      TActInput=procedure (iHandle:THandle;var cdsSystem;iActInputID:integer);stdcall;
    var
      ThisHandle:THandle;
      ActInput:TActInput;
    begin
      ThisHandle:=LoadLibrary('ActInput.DLL');
      if ThisHandle<>0 then
      begin
        @ActInput:=GetProcAddress(ThisHandle,'StartForm');
        if @ActInput<>nil then
          ActInput(iHandle,dmSystem.cdsSystem,iActInputID);
        //FreeLibrary(ThisHandle);
      end;
    end;
      

  2.   

    上面是原代码,由于窗体是Show,不能 FreeLibrary(ThisHandle);