Home > Back-end >  Delphi Usb cashbox
Delphi Usb cashbox

Time:09-26

Ace to give a trouble, Usb printer, can open the box code, don't appreciate, and stick to 100 points

CodePudding user response:

Have the official manual don't

CodePudding user response:

USB ticket machine can control through a printer driver itself open coffers have to drive to support
General cashier software couldn't coffers through USB printer control can control through serial or parallel printer cashbox

Baidu answers

CodePudding user response:

If this is a serial port or parallel port printer, seemingly don't have to install the printer driver, but the USB printer, to install the driver can,

CodePudding user response:

Var
Handle: THandle;
N: DWORD;
DocInfo1: TDocInfo1;
Device: an array of char [0.. 255];
Driver: an array of char [0.. 255];
Port: an array of char [0.. 255];
HMode: Cardinal;
S: a string;
The begin
Printer. GetPrinter (Device, Driver, Port, hMode);
If not OpenPrinter (@ Device, Handle, nil) then
The begin

The Exit;
end;
With DocInfo1 do begin
PDocName:=PChar (' test doc); {in the print list of print content}
POutputFile:=nil;
PDataType:='RAW'; {key, the data type must be RAW, this printer by driver to identify ZPL language}
end;
S:=AnsiString (CRH (27) + CRH (112) + CRH (0) + CRH (60) + CRH (255));
Try
StartDocPrinter (Handle, 1, @ DocInfo1);
StartPagePrinter (Handle);
WritePrinter (Handle, PChar (S), Length (S), N);
EndPagePrinter (Handle);
EndDocPrinter (Handle);

The finally
ClosePrinter (Handle);
end;
end;

Premise is to change the printer as the default printer

CodePudding user response:

Do you want to take a look at the USB cashbox SDK
  • Related