procedure TForm1.Button1Click(Sender: TObject);
var
RPrinter:TextFile;
i:integer;
begin
{设置打印机}
Assignfile(RPrinter,'lpt1');
{准备写文件}
Rewrite(RPrinter);
{打印}
for i := 0 to memo1.lines.Count - 1 do
Writeln(RPrinter,memo1.lines[i]);
{向后倒纸}
Writeln(RPrinter,chr($b)+chr(27)+'K'+chr(40));
{向前进纸}
Writeln(RPrinter,chr($b)+chr(27)+'J'+chr(140));
{开钱箱}
writeln(f,CHR(27)+CHR(112)+CHR(0)+CHR(17)+CHR(8));
write(f,CHR(27)+CHR(112)+CHR(0)+CHR(17)+CHR(8));
Chr(27)+'p'+chr(0)+chr(60)+chr(255)
{关闭打印机}
CloseFile(RPrinter);
end;
如何检测“LPT1” 端口是否可以用!
var |