在Dll中调用COM相关内容(比如ClientDataset使用了Midas库),需要在使用前调用CoInitialize函数,结束后使用CoUninitializa函数。建议在程序单元的initialization和finalization段中执行这些初始化/解除COM调用设置的代码。

解决方案 »

  1.   

    to:Miracle()  好像不是这个原因.
      

  2.   

    我调试过,只要不包含FR_DBSet, FR_View, FR_Class, FR_Desgn这些单元,程序退出就不会出现上述问题,各位有办法解决吗??如果不用这些单元的话,我要做的功能就出来了。
      

  3.   

    我调试过,只要不包含FR_DBSet, FR_View, FR_Class, FR_Desgn这些单元,程序退出就不会出现上述问题,各位有办法解决吗??如果不用这些单元的话,我要做的功能就出不来了。
    一字之差,谬之千里 
      

  4.   

    {******************************************}
    {                                          }
    {             FastReport v2.4              }
    {             Progress dialog              }
    {                                          }
    { Copyright (c) 1998-2001 by Tzyganenko A. }
    {                                          }
    {******************************************}unit FR_progr;interface{$I FR.inc}uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, FR_Class, FR_Const;const
      CM_BeforeModal = WM_USER + 1;type
      TfrProgressForm = class(TForm)
        Button1: TButton;
        Label1: TLabel;
        Label2: TLabel;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
        FDoc: TfrReport;
        FOnBeforeModal: TNotifyEvent;
        procedure CMBeforeModal(var Message: TMessage); message CM_BeforeModal;
        procedure Localize;
      public
        { Public declarations }
        FirstCaption: String;
        property OnBeforeModal: TNotifyEvent read FOnBeforeModal write FOnBeforeModal;
        function Show_Modal(Doc: TfrReport): Word;
      end;
    implementationuses FR_Utils;{$R *.DFM}function TfrProgressForm.Show_Modal(Doc: TfrReport): Word;
    begin
      Localize;
      FDoc := Doc;
      Label2.Caption := '';
      PostMessage(Handle, CM_BeforeModal, 0, 0);
      Result := ShowModal;
    end;procedure TfrProgressForm.Button1Click(Sender: TObject);
    begin
      FDoc.Terminated := True;
      ModalResult := mrCancel;
    end;procedure TfrProgressForm.CMBeforeModal(var Message: TMessage);
    begin
      if Assigned(FOnBeforeModal) then FOnBeforeModal(Self);
    end;procedure TfrProgressForm.Localize;
    begin
      Button1.Caption := frLoadStr(SCancel);
    end;end.
      

  5.   

    有感于 leemingsong(陨石) qq上答题,另外给分