W
wglifs
Unregistered / Unconfirmed
GUEST, unregistred user!
我的代码如下,一般几十张能正常打印,但打印几百张或更多时出现数据混乱的情况:while not QryData.Eof dobegin PrnStr := '^XA'; Barcode0 := Copy(Barcode,1,10); Barcode1 := Copy(Barcode,11,5); Barcode2 := Copy(Barcode,16,5); PrnStr := PrnStr + '^FO10,10^ARN,70,62^FD'+Barcode0+'-'+'^FS'; PrnStr := PrnStr + '^FO10,50^ARN,105,93^FD'+Barcode1+'^FS'; PrnStr := PrnStr + '^FO10,100^ASN,120,105^FD'+Barcode2+'^FS'; PrnStr := PrnStr + '^FO50,150^BY6^BCN,380,N,N,N,A^FD' + Barcode + '^FS'; PrnStr := PrnStr + '^FO50,200^AVN,45,26^FD'+Barcode+'^FS'; PrnStr := PrnStr + '^FO300,300^BY4^B3N,N,250,N,N^FD' + Barcode + '^FS'; PrnStr := PrnStr + '^FO500,350^ATN,45,26^FDPO CUT: '+POCut+'^FS'; PrnStr := PrnStr + '^FO150,500^ATN,45,26^FDSize:'+Size0+'^FS'; PrnStr := PrnStr + '^XZ'; try fHandle := fileopen('COM1', fmOpenWrite); if fHandle > 0 then begin SetupComm(fHandle,4096,4096); GetCommState(fHandle,dcb); dcb.BaudRate := 9600; dcb.ByteSize :=8; dcb.Parity :=NOPARITY; dcb.StopBits :=ONESTOPBIT; filewrite(fHandle, pchar(prnstr)^, length(prnstr)) ; end finally fileclose(fHandle); end; QryData.Next;end;