这是删除打印作业的功能
def DeletePrintJob(job_id):
printer_info_level = 1
for printer_info in win.EnumPrinters(win.PRINTER_ENUM_LOCAL, None, printer_info_level):
name = printer_info[2]
#print(printer_info)
printer_handle = win.OpenPrinter(name)
job_info_level = 1
job_info_tuple = win.EnumJobs(printer_handle, 0, -1, printer_info_level)
#print(type(job_info_tuple), len(job_info_tuple))
for job_info in job_info_tuple:
print("\t", type(job_info), job_info, dir(job_info))
win.SetJob(printer_handle, job_id, 0, None,win.JOB_CONTROL_DELETE)
win.ClosePrinter(printer_handle)
我将Job_id传递给上面的函数并遍历打印作业。当我得到工作信息时,使用SetJob;我删除了打印作业。 但SetJob函数返回None。如何知道SetJob函数是否删除了预期的作业ID?有人会帮我解决这个问题吗?