From 7b31a537fa5e45930fc5ddec19300c02ba288a43 Mon Sep 17 00:00:00 2001 From: derit Date: Wed, 3 Jan 2018 10:32:46 +0700 Subject: [PATCH] fixed for compatible printer api Delphi Xe up --- RawPrinter.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/RawPrinter.pas b/RawPrinter.pas index ffa3e0f..fce9781 100755 --- a/RawPrinter.pas +++ b/RawPrinter.pas @@ -114,7 +114,11 @@ ERAWPrinterError = class(ERAWPrinterException); TRAWPrinter = class(TComponent) private fESCList : array[0..ESC_MAX] of string; + {$if CompilerVersion > 18} + fPrnHandle : THandle; + {$ELSE} fPrnHandle : DWord; + {$ENDIF} fPrnName : string; fPrnMode : TRAWPrinterMode; fPrnStatus : TRAWPrinterStatus; @@ -411,7 +415,11 @@ function TRAWPrinter.BeginDoc: boolean; if (fPrnStatus = rpsClosed) then begin if (fPrnName = '') then SetToDefaultPrinter; - if OpenPrinter(PChar(fPrnName), fPrnHandle, nil) then fPrnStatus := rpsOpened + {$if CompilerVersion > 18} + if OpenPrinter(PWideChar(fPrnName), fPrnHandle, nil) then fPrnStatus := rpsOpened + {$ELSE} + if OpenPrinter(PChar(fPrnName), fPrnHandle, nil) then fPrnStatus := rpsOpened + {$ENDIF} else raise ERAWPrinterError.Create(Format(errPrinterError, [fPrnName])); end;