USB打印机开钱箱

type
  TOutBufPassThrough = record   // 用于USB接口打印机开钱箱
  // 调用windows.extEscape可以直接用extEscape(handle, PASSTHROUGH, sizeOf(outBuf), @outBuf, 0, nil)向设备发送esc命令
    nDataLen: word;
    sEscData: array [0 .. 1024] of AnsiChar;
  end;

procedure TFrmCollectionOrder.OpenUSBMoneyBox;
var
  prt: TPrinter;
  esc: TOutBufPassThrough;
  sMoneyBoxOpenCommand: AnsiString;
begin
  try
    prt := Printers.Printer;
    prt.beginDoc;
    sMoneyBoxOpenCommand := AnsiString(const_OpenMoneyBoxCommand);
    esc.nDataLen := Length(sMoneyBoxOpenCommand);
    strpCopy(esc.sEscData, sMoneyBoxOpenCommand);
    Windows.ExtEscape(prt.Handle, PASSTHROUGH, sizeOf(esc), @esc, 0, nil);
    // PASSTHROUGH:允许程序直接发送数据到设备
    prt.endDoc;
  except

  end;
end;

posted @ 2013-01-05 17:38  delphi中间件  阅读(1052)  评论(0编辑  收藏  举报