请大家帮帮忙解决问题,真的很急???一定重分谢答。
我是在dll文件里建立两个form,在进行回路调用时,出错,但在exe里是没问题的。
请看代码:
调用dll文件的exe
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  Tshowform=procedure (parentApplication:TApplication);StdCall;
  EDLLLoadError=class(exception);type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  procedure OpenForm(mainForm:TForm);stdcall;External'project2.dll';
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
  OpenForm(Application.MainForm);
end;end.///dll文件
library Project2;{ 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
  SysUtils,
  Classes,
  Forms,
  Unit3 in 'Unit3.pas' {Form1},
  Unit4 in 'Unit4.pas' {Form2};{$R *.res}exports
  OpenForm;
beginend.//dll里的第一个窗体
unit Unit3;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, QRPrntr;type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    QRPreview1: TQRPreview;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  procedure OpenForm(mainForm:TForm);stdcall;implementationuses Unit4;{$R *.dfm}procedure OpenForm(mainForm:TForm);stdcall;
var
  Form1: TForm1;
  ptr:PLongInt;
begin
  ptr:=@(Application.MainForm);
  ptr^:=LongInt(mainForm);
  Form1:=TForm1.Create(mainForm);
  Form1.Show;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:=caFree;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2:=TForm2.Create(Self);
  Label1.Caption:=IntToStr(Form2.ss);
  showmessage(IntToStr(Form2.ss));
  Form2.QR1.Preview;
end;end.//dll里的第二个窗体
unit Unit4;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, QRCtrls, QuickRpt, ExtCtrls;type
  TForm2 = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    First: TPanel;
    QR1: TQuickRep;
    TitleBand1: TQRBand;
    QRTitle1: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel14: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel6: TQRLabel;
    QRShape3: TQRShape;
    QRShape11: TQRShape;
    QRShape12: TQRShape;
    QRShape13: TQRShape;
    QRShape14: TQRShape;
    QRShape7: TQRShape;
    QRShape9: TQRShape;
    QRShape8: TQRShape;
    QRShape2: TQRShape;
    QRShape1: TQRShape;
    QRShape10: TQRShape;
    DetailBand1: TQRBand;
    QRShape4: TQRShape;
    QRShape5: TQRShape;
    QRButtomLine1: TQRShape;
    QRShape16: TQRShape;
    QRShape17: TQRShape;
    QRShape18: TQRShape;
    QRShape19: TQRShape;
    QRShape20: TQRShape;
    QRShape21: TQRShape;
    QR1DBText1: TQRDBText;
    QR1DBText2: TQRDBText;
    QR1DBText3: TQRDBText;
    QR1DBText4: TQRDBText;
    QR1DBText5: TQRDBText;
    QR1DBText6: TQRDBText;
    QR1DBText7: TQRDBText;
    QRShape6: TQRShape;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure QR1Preview(Sender: TObject);
  private
    { Private declarations }
  public
    ss: integer;
    { Public declarations }
  end;var
  Form2: TForm2;
implementationuses Unit3;{$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);
begin
  ss:=11;
end;procedure TForm2.FormCreate(Sender: TObject);
begin
  ss:=11;
end;procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:=caFree;
end;procedure TForm2.QR1Preview(Sender: TObject);
begin
Form1.QRPreview1.QRPrinter:=QR1.Printer;
end;end.//现在运行时出现错误,错误提示:
Access violation at address 00232073 in module 'project2.dll'.read of address 000002FB如有需要,我可把程序发给你,请写下邮件地址.

解决方案 »

  1.   

    不是数据集的问题,这个问题我已经解决了,谢谢大家不过我想问问用一个clientdataset来创建一个虚拟数据表可不可以在报表上显示出来?
      

  2.   

    用一个clientdataset来创建一个虚拟数据表可不可以在报表上显示出来?
    答:可以。一样用啦。
      

  3.   

    cientdataset所取的远程数据本来就是你所说的虚拟数据集(内存数据集),只要是ClientDataSet认可的数据格式,都可以显示打印的