I wrote a program which uses Quick Reports version 2.0 in Delphi 3. One
of our clients, who uses Windows NT version 4.00.1381 (build 1381)
service pak 5, gets a "General Protection Fault"(eg. Access Violation at
address ...)when he tries to access that program which has the quick
reports inside of it.
The client is working from a windows nt work station but said that the
same problem occurs in Windows 2000. The same program works in Windows
95 and 98.
He said that even when he logged on as the administrator he had the same
problem.
Has anybody seen this problem before? Any one have any ideas? Any help
would be greatly appreciated.
Thanx.
Mike.
--
Steve F (Team B)
Also note that you will also have problems if there is no default
printer installed.
Regards,
Colin Acheson
Q. My report works under 95 but not under NT
A. When the report crashes at 25 to 50 pages and the OS is NT, then
the problem is usually file permissions based. QR2 renders the report
to a temporary file if it can't do it in RAM. QuickReport calls the
Delphi GetTempPath() and GetTempFileName() functions to build the
filename. These functions check directories specified by the TMP, and
TEMP variables, and if they fail, the current directory. If the user
does not have sufficient access to create a temporary file, then an
error will occur.
On Fri, 21 Jul 2000 14:22:19 -0400, Mike Fleet <mfl...@clarisys.ca>
wrote:
Version 2 is far more reliable. I purchased the source code for 2.0k
and spent a lot of time fixing it. I'm not going to do that again.
Version 3 adds a couple of minor enhancements but nothing of any
significance to me. I even removed 3.05 from Delphi 5 and installed
2.0k instead (with a great deal of difficulty and many magic words).
QR3.05 is unuseable without fixing the access violation bug in the
preview. The source code is required for that.
Qusoft are just starting to get V3 to a useable state with 3.07 but
who knows when or whether the standard version of that will be
released. I should mention that the Delphi 3 printers unit also had
some bugs and a memory leak, so Qusoft are not the only ones at fault.
Regards,
Colin Acheson
>Maybe you could shed some light on the bugs you have found so that we =
>can avoid them, too? I use Delphi 3.00 C/S under Windows 98; maybe I =
>could correct my VCL source code accordingly.
This should really be in the reporting-charting group. I've posted
the bug fixes there several times. I won't repeat the QR bugs here,
just those in D3 printers unit.
Firstly, there is also a memory leak:
Before the last line "Inherited Destroy;" in TPrinter.Destroy, insert
the following:
if DeviceMode <> 0 then
begin
GlobalUnlock(DeviceMode);
GlobalFree(DeviceMode);
DeviceMode := 0;
end;
Secondly, when the printer selection is changed on Windows NT with
some printers (especially those connected as network devices via print
servers), Delphi 3 does not recognize the printer in the printers
list. Instead of selecting the correct printer index, it adds the
printer again at the end of the list and assigns a new (invalid)
printer index. Any attempt to print to it will produce an EPrinter
exception of 'Printer Index Out of Range'.
The error is at approx. line 413 of Printers.pas in the following
function:
function TPrinterDevice.IsEqual(ADriver, ADevice, APort: PChar):
Boolean;
begin
Result := (Device = ADevice) and (Port = APort);
end;
I'm not sure whether it was first corrected in D4 or D5 but it should
be replaced by the Delphi 5 equivalent, which is:
Result := (Device = ADevice) and ((Port = '') or (Port = APort));
Thirdly, there is a problem with the DEVICEMODE when a new printer is
selected rather than the windows default printer. The following was
submitted by Pascalis Bochoridis. I've edited down the long posting
as much as possible (apologies to Pascalis).
I have an application that prints to 2 different printers.
The one is a dot-matrix , the other is a laser.
The report that goes to the laser has Copies = 3
I noticed that when the dot - matrix is set as the default printer,
then only 1 copy comes out from the laser instead of 3.
When the laser is default then it prints the 3 copies as is right.
When you change the PrinterIndex, the settings of the PREVIOUS
default printer are still in action instead of acquiring new values.
In my case, my dot-matrix does not have multiple copies capability
It has FPrinter.Capabilities = [cpOrientation]
The laser has FPrinter.Capabilities = [cpCopies,
cpOrientation,cpCollate]).
Because of the SAME DEVICEMODE bug, when the dot-matrix was default
the laser was "transformed" to a dot-matrix, that is
it showed FPrinter.Capabilities = [cpOrientation] and thus couldn't
print multiple copies.
I noticed that in method
procedure TPrinter.SetToDefaultPrinter;
var
I: Integer;
DefaultPrinter: array[0..79] of Char;
Cur, Device: PChar;
begin
GetProfileString('windows', 'device', '', DefaultPrinter,
SizeOf(DefaultPrinter) - 1);
Cur := DefaultPrinter;
Device := FetchStr(Cur);
with Printers do
for I := 0 to Count-1 do
begin
if TPrinterDevice(Objects[I]).Device = Device then
begin
with TPrinterDevice(Objects[I]) do
{***********************************************************
SetPrinter passes 0 as DeviceMode (Fouth parameter)
causing the deallocation and allocation of a new DeviceMode
***********************************************************}
SetPrinter(PChar(Device), PChar(Driver), PChar(Port), 0);
Exit;
end;
end;
RaiseError(SNoDefaultPrinter);
end;
In method
procedure TPrinter.SetPrinterIndex(Value: Integer);
begin
CheckPrinting(False);
if (Value = -1) or (PrinterIndex = -1) then SetToDefaultPrinter
else if (Value < 0) or (Value >= Printers.Count) then
RaiseError(SPrinterIndexError);
{*************************** PROBLEM!!!! *************************
When Value is <> -1 that is when we set the PrinterIndex to 1,2 etc
SetPrinter DOES NOT EXECUTE and the DEVICEMODE remains FROM
THE PREVIOUS SELECTED PRINTER causing the above problems
*************************** PROBLEM!!!! *************************}
FPrinterIndex := Value;
FreeFonts;
SetState(psNoHandle);
end;
The solution (applies to both registered or non registered users of
QuickReport) Edit the SetPrinterIndex method
procedure TPrinter.SetPrinterIndex(Value: Integer);
begin
CheckPrinting(False);
if (Value = -1) or (PrinterIndex = -1) then SetToDefaultPrinter
else if (Value < 0) or (Value >= Printers.Count) then
RaiseError(SPrinterIndexError);
FPrinterIndex := Value;
{**************** THIS IS THE NEW CODE ***********************}
if (FPrinterIndex >= 0) and (FPrinterIndex < Printers.Count) then
begin
with Printers, TPrinterDevice(Objects[FPrinterIndex]) do
SetPrinter(PChar(Device), PChar(Driver), PChar(Port), 0);
end;
{*************************************************************}
FreeFonts;
SetState(psNoHandle);
end;
By the way TDevideMode controls many things
as you can see by it's definition in SOURCE\RTL\WIN\WINDOWS.PAS so the
above correction may solve other unexplained printing problems.
--
Ossama Elkadi
(Please reply only into the newsgroup
unless explicitly asked to do otherwise.
When sending e-mail, remove the NOSPAM
from the e-mail address)
On Sat, 22 Jul 2000 06:43:47 GMT, (no direct mail please) (Colin
Acheson) wrote:
>Version 2 is far more reliable. I purchased the source code for 2.0k
>and spent a lot of time fixing it. I'm not going to do that again.
>Version 3 adds a couple of minor enhancements but nothing of any
>significance to me. I even removed 3.05 from Delphi 5 and installed
>2.0k instead (with a great deal of difficulty and many magic words).
>QR3.05 is unuseable without fixing the access violation bug in the
>preview. The source code is required for that.
>
>Qusoft are just starting to get V3 to a useable state with 3.07 but
>who knows when or whether the standard version of that will be
>released. I should mention that the Delphi 3 printers unit also had
By the way Anders, you should know that they don't listen to registered
users also. This company is run by imbeciles. For the sake of many, the best
thing would be that they sell this company.
Pierre
Anders LEE <and...@aelhk.com> a écrit dans le message :
5aavnsotrfgbgea58...@4ax.com...