There is a bug in Quick Reports (Whats new) with the function TempFilename.
It allocates 80 bytes each for a temp filename and directory, but when it
calls the getTempPath function only asks for 30.

Under WINDOWS 2000 my temp directory became

E:\Documents and Settings\Administrator (ADROCK)\Local Settings\Temp

Quite a bit more than 30 characters. The getTempPath returns about 3
characters like little box's []

No reports would work, I got AccessViolations, Can't Create File, and
ExternalException messages.

I located the problem down to the TempFileName function. I changed the 80 to
256, and the 30 to 255. This fix corrected the problems I was receiving.

Quick Reports only writes the MetaFile to the disk if the report is more
than 100,000 bytes long. I could not understand it as sometimes it would
work for 2 page reports, and others would not work, and cause AV, and other
errors.

Original QR Code
================

function TempFilename : string;
var
  AName,
  ADir : array[0..80] of char;
begin
  GetTempPath(30, adir);
  GetTempFilename(aDir, PChar('QRP'), 0, aName);
  result := StrPas(aName);
end;

Line 755, QRPRNTR.PAS

New Code
========

function TempFilename : string;
var
  AName,
  ADir : array[0..256] of char;
begin
  GetTempPath(255, adir);
  GetTempFilename(aDir, PChar('QRP'), 0, aName);
  result := StrPas(aName);
end;

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to