Access Violation error when trying to assign the Printer
Hi,
We are using Delphi XE7 with Fast-Report Enterprise 5.6.
Since upgrading to 5.6 we are encountering an Access Violation exception when trying to assign the chosen printer name to the TfrxReport.PrintOptions.Printer property.
Here's the code that I have:
This is code that we had for over 10 years without any problems. And, we do have the same code running with a previous version of Fast-Report and that is not generating any errors.
Daniel Rail
We are using Delphi XE7 with Fast-Report Enterprise 5.6.
Since upgrading to 5.6 we are encountering an Access Violation exception when trying to assign the chosen printer name to the TfrxReport.PrintOptions.Printer property.
Here's the code that I have:
            frxReport1.PrintOptions.Collate := dlgPntPrintStatements.Collate;
            frxReport1.PrintOptions.Copies := dlgPntPrintStatements.Copies;
            vPrinterName := Printer.Printers[Printer.PrinterIndex];
            {$IFDEF DEBUG}
            MessageDlg('Printer Name = '+vPrinterName, mtInformation, [mbOK], 0);
            {$ENDIF}
            frxReport1.PrintOptions.Printer := vPrinterName;
The Collate and Copies properties work without any problems. The MessageDlg will display the vPrinterName value. But, the line "frxReport1.PrintOptions.Printer := vPrinterName;" generates an Access Violation.This is code that we had for over 10 years without any problems. And, we do have the same code running with a previous version of Fast-Report and that is not generating any errors.
Daniel Rail
Comments
2. What is build number of previous version of Fast Report?
The vPrinterName value is "Canon MF8300 Series UFRII LT". And, that value comes straight from Printer.Printers[Printer.PrinterIndex], as in the code that I supplied originally. And, this is reproducible on other computers with other printers(i.e.: HP and Epson printers)
I even tried for fun the following:
MessageDlg('frxReport.PrintOptions.Printer = '+frxReport1.PrintOptions.Printer, mtInformation, [mbOK], 0);
And, an Access Violation exception is raised when executing that line.
And, I also get an Access Violation exception on the following line:
frxReport1.ReportOptions.Compressed := False;
The previous version that we used that worked is 5.5.11.
I just upgraded to 5.6.1, and the problem still persists.
The problem only occurs when using packages. The problem doesn't occur if not using packages. I did do a recompile of the packages, just to be certain. And, I also made certain that no other version of the package can be located on the computer. And, I have to use packages, because the application uses a plugin architecture that requires to build with packages.
I forgot that version 5.5 was installed on the E: drive, and when I installed 5.6, I used the default folder on the C: drive. And, this was causing the problems, since Delphi was using the .bpl files on the E: drive and then the application was using those on the C: drive for runtime.