Re: Access violation in CreateForm

Tom Nesler <[email protected]> Mon, 15 Apr 2002 06:54:27 -0700 (PDT)
Newsgroups gmane.comp.lang.delphi.quick-reports
Message-ID <[email protected]>
Hi Jeff!
--- jeffgallant2002 <[email protected]> wrote:
> We have a Delphi 3 application that uses QR. Normally program is 
> quite happy but we have recently had several instances on WinNT and 
> now one on Win XP where the following happens.
> 
> 1) Users use the program quite happily for several weeks.
> 
> 2) Suddenly, with no apparent reason, it stops working. They report 
> Access Violation in <application name> before the main screen is 
> displayed.
> 
> Using the old-fashioned technique of creating a diagnostic version of
> 
> the program, I can trace the failure to the "CreateForm" call for the
> 
> first module that contains a QR report in the project source.
> 
> I then created another diagnostic version that moved all of the QR 
> module "CreateForm"s further down the list and the diagnostics showed
> 
> that the program failed whilst creating exactly the same module.
> 
> I have not overridden the Create method for this class.
> 
> In the case of the NT 4 PCs, we can reset them to their original 
> state and the application runs again. This is not an option in the 
> case of the XP PC.
> 
> Any ideas?

The latest version of QR (3.5.X) has workarounds for XP and W2K
machines.  Check the Temp path in your environment settings and make
sure the length is not too long. If it is, create a new temp dir under
windows and use it (C:\Windows\Temp).  This is a known bug for the
older versions of QR.

I recommend creating your QR forms only as you need them.  This is a
better memory management technique.  To do this use this technique:

Procedure Tform1.PrintReptClick(Sender:TObject);
Var
 FrmBudgetVsActual: TFrmBudgetVsActual;  {Report Variable}

Begin
 Windowstate := wsMinimized;  {Hide main form}
 FrmBudgetVsActual:= TFrmBudgetVsActual.Create(Self);  {Create Rept}
 Try
  FrmBudgetVsActual.quickRep1.Preview;  {Preview method}
  FrmBudgetVsActual.Release;            {Cleanup form}
 finally
  Windowstate := wsNormal;              {Show main form}
 end;
 end;


It probably won't solve your problem but at least you can get your app
started before it blows up! :-)



=====
Tom Nesler

Live Long...Code Well... and Prosper! V

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/