C
cypl
Unregistered / Unconfirmed
GUEST, unregistred user!
我想实现连续打印,比如100条记录打印在专门印制的100张连续的卡片上,一条记录打印在<br>一张卡片上,循环打印完,但中间想能控制,否则就一次发了100条打印信息,无法控制,我<br>就想当获取一条记录打印完成后的信息,然后在发第二条记录,这样好控制,但不知道如何<br>获取打印完成的信息,搜索了一下以前的帖子,找到了一段代码,但无法编译,帮忙看看!<br>我还没搞懂API函数的用法,请各位帮忙指点一二,最好能详细讲讲,谢谢!<br><br>procedure Tform1.GetJobs(PrinterName: String);<br>const<br> InfoLevel = 1;<br> FirstJob = 0;<br> LastJob = 19;<br>var<br> Jobs: array [FirstJob..LastJob] of TJobInfo1;<br> PrinterHandle:Cardinal;<br> BytesNeeded, NumJobs: Cardinal;<br> I:integer;<br> jobid:Cardinal;<br> cur_row:integer;<br> rowslevariant;<br>begin<br> if OpenPrinter(PChar(PrinterName),Printerhandle,nil) then begin<br> if EnumJobs(PrinterHandle,FirstJob,LastJob,1,InfoLevel,Jobs,SizeOf(Jobs),BytesNeeded,NumJobs) then begin<br> if NumJobs>0 then begin<br> rows:=VarArrayCreate([0,10, 0, 0], varVariant);<br> for I := 0 to NumJobs-1 do begin<br> with Jobs do begin<br> cur_row:=VarArrayHighBound(rows, 2);<br> rows[0, cur_row]:=JobId;<br> rows[1, cur_row]:=StrPas(pPrinterName);<br> rows[2, cur_row]:=StrPas(pMachineName);<br> rows[3, cur_row]:=StrPas(pUserName);<br> rows[4, cur_row]:=StrPas(pDatatype);<br> rows[5, cur_row]:=StrPas(pDocument);<br> rows[6, cur_row]:=StrPas(pStatus);<br> rows[7, cur_row]:=Priority;<br> rows[8, cur_row]:=Position;<br> rows[9, cur_row]:=TotalPages;<br> rows[10, cur_row]:=PagesPrinted;<br> end;<br> VarArrayRedim(rows, cur_row + 1);<br> setJob(DevM,Jobid,0,@Jobs,JOB_CONTROL_PAUSE);<br><br> end;<br> lv.Items.Clear;<br> ListViewAddRows(rows,lv);<br> //ClosePrinter(PrinterHandle);<br> end;<br> end;<br> end;<br><br>end;<br>