Home > database >  Task time problem printing
Task time problem printing

Time:10-01

Using API function: enumjobs, the structure of the obtained jobs_info_2 content, but the address values Submitted to return to the SYSTEMTIME structure, how to obtain the actual structure of address values?

Thank you very much!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

What I use is job_info_1 the systemtime also make for a long time have no, later found out that in fact is I think so complicated, actually in the case of structure set structure actually does not need special treatment, as the normal way to go,

First statement systemtime structure, global structure for eight int item;
Statement again job_info_1 global structure, the type of the submitted is specified for systemtime can, other item types all ulong

 
//print task status value
//the return value for the number of print tasks, return 1, error

/*
Constant ulong JOB_STATUS_PAUSED=1
Constant ulong JOB_STATUS_ERROR=2
Constant ulong JOB_STATUS_DELETING=4
Constant ulong JOB_STATUS_SPOOLING=8
Constant ulong JOB_STATUS_PRINTING=16
Constant ulong JOB_STATUS_OFFLINE=32
Constant ulong JOB_STATUS_PAPEROUT=64
Constant ulong JOB_STATUS_PRINTED=128
*/
Constant ulong JOB_INFO_1_LEN=(13 + 3) * 4//3 is probably the number of data type
Constant ulong SYSTEMTIME_LEN=8 * 2

Long nloop RTN, ll_size
Ulong ll_Needed, ll_Returned
Job_info_1_pb lstr_info
Systemtime lstr_systime
Blob lbl_buffer, lbl_tmp
String ls_docname ls_printer, ls_null
Printer_defaults lstr_printer_defaults


If al_hprinter=0 then
//get the current printer
Ls_printer=ProfileString (" win. Ini ", "Windows", "device", "")

RTN=Pos (ls_printer, ", ")
If RTN & lt;> 0 then
Ls_printer=Left (ls_printer RTN - 1)
The else
MessageBox (" error ", "Win. Ini file is not specified the default printer!" , StopSign!)
The return - 1
End the if

//get the printer handle
SetNull (ls_null)
Lstr_printer_defaults. PDatatype=ls_null
Lstr_printer_defaults. PDevMode=0
Lstr_printer_defaults. DesiredAccess=8
RTN=OpenPrinter (ls_printer al_hPrinter, lstr_printer_defaults)
If RTN=0 then
MessageBox (" error "and" printers "" + ls_printer +" "unable to open!" , StopSign!)
The return - 1
End the if

End the if


Ll_Size=0

L_GetJob:
Lbl_buffer=blob (Space (ll_size))
If EnumJobs (al_hprinter, 0, 65535, 1, lbl_buffer, ll_size, ll_Needed, ll_Returned)=0 then
If ll_size & lt; Ll_Needed then
Ll_size=ll_Needed
Goto l_GetJob
The else
The return - 1
End the if
End the if

For nloop=1 to long (ll_Returned)
Lbl_tmp=BlobMid (lbl_buffer, (nloop - 1) + 1) * JOB_INFO_1_LEN
CopyMemory (lstr_info lbl_tmp, JOB_INFO_1_LEN)

Astr_job_info1 [nloop]. Jobid=lstr_info. Jobid
Astr_job_info1 [nloop] pprintername=string (lstr_info pprintername, "address")
Astr_job_info1 [nloop] pmachinename=string (lstr_info pmachinename, "address")
Astr_job_info1 [nloop] pusername=string (lstr_info pusername, "address")
Astr_job_info1 [nloop] pdocument=string (lstr_info pdocument, "address")
Astr_job_info1 [nloop] pdatatype=string (lstr_info pdatatype, "address")
Astr_job_info1 [nloop] pstatus=string (lstr_info pstatus, "address")
Astr_job_info1 [nloop] status=lstr_info. Status
Astr_job_info1 [nloop]. Priority=lstr_info. Priority
Astr_job_info1 [nloop] position=lstr_info. Position
Astr_job_info1 [nloop]. Totalpages=lstr_info. Totalpages
Astr_job_info1 [nloop]. Pagesprinted=lstr_info. Pagesprinted

Astr_job_info1 [nloop] submitted. Wyear=lstr_info. Submitted. Wyear
Astr_job_info1 [nloop] submitted. Wmonth=lstr_info. Submitted. Wmonth
Astr_job_info1 [nloop] submitted. The wdayofweek=lstr_info. Submitted. The wdayofweek
Astr_job_info1 [nloop] submitted. Wday=lstr_info. Submitted. Wday
Astr_job_info1 [nloop] submitted. Whour=lstr_info. Submitted. Whour
Astr_job_info1 [nloop] submitted. Wminute=lstr_info. Submitted. Wminute
Astr_job_info1 [nloop] submitted. Wsecond=lstr_info. Submitted. Wsecond
Astr_job_info1 [nloop] submitted. Wmillisecond=lstr_info. Submitted. Wmillisecond
Next

Return ll_Returned


  • Related