我使用PrintDBGridEh控件预览 DBGridEh的表格时(在DLL)中,预览及退出预览窗口的时候一切正常,但是在退出调用预览功能的窗口时,就会出现在一个访问地址的错误('Access violation at address 40031A6F in module 'rtl60.bpl'.Read of address 04B6A924'),这个rtl60.bpl应该是delphi自己的包,不明白为何会出现这样的错误。
而同样的代码,只要不在DLL中进行调用,就一切正常,不知各位有没有碰到这样的问题,又是如何解决的?
我用的版本是Ehlib2.6

解决方案 »

  1.   

    以下是我的DLL的代码
    library DemandHistory;uses
      Forms,
      FrontCash in 'FrontCash.pas' {FormFrontCash};procedure History(AHandle:THandle;ACaption,Oper,HotelName:string);stdcall;
    var
      OldHandle:THandle;
    begin
      OldHandle:=Application.Handle;
      Application.Handle:=AHandle;
      FormFrontCash:=TFormFrontCash.Create(Application);
      try
        FormFrontCash.Operationer:=Oper;
        FormFrontCash.Hotel_Name:=HotelName;
        if Length(ACaption)>0 then FormFrontCash.Caption:=ACaption;
        FormFrontCash.ShowModal;
      finally
        FormFrontCash.Free;
        FormFrontCash:=nil;
        Application.Handle:=OldHandle;
      end;
    end;exports
      History;begin
      //跟踪到这里就出现上述错误了!
    end.
    使用的是动态调用