Registriert seit: 5. Mär 2013
502 Beiträge
Delphi 7 Enterprise
|
AW: Kassenlade öffnen
24. Jun 2014, 16:17
also habe jetzt diesen code
Delphi-Quellcode:
procedure OpenCashDrawer;
var
hPrinter, hDeviceMode: THandle;
N: DWORD;
DocInfo1: TDocInfo1;
Device, Driver, Port: array [0 .. 255] of Char;
PrinterName, ThePrinter: string;
Code: AnsiString;
begin
begin
Code := AnsiChar(27) + AnsiChar(112) + AnsiChar(0) + AnsiChar(64) + AnsiChar(240);
Printer.PrinterIndex := Printer.Printers.IndexOf('CognitiveTPG Receipt');
Printer.BeginDoc;
//Printer.NewPage;
WritePrinter(Printer.Handle, PAnsiChar(Code), Length(Code), N);
Printer.EndDoc;
if not WinSpool.OpenPrinter(PChar(PrinterName), hPrinter, nil) then
begin
ShowMessage('Error : ' + IntToStr(GetLastError));
Exit;
end;
with DocInfo1 do
begin
pDocName := 'Test';
pOutputFile := nil;
pDataType := 'RAW';
end;
WinSpool.StartDocPrinter(hPrinter, 1, @DocInfo1);
WinSpool.StartPagePrinter(hPrinter);
WinSpool.WritePrinter(hPrinter, PAnsiChar(Code), Length(Code), N);
WinSpool.EndPagePrinter(hPrinter);
WinSpool.EndDocPrinter(hPrinter);
WinSpool.ClosePrinter(hPrinter);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
opencashdrawer;
end;
zeigt mir fehler 1801 an. und die lade bleibt zu
|
|
Zitat
|