PRINTER_NOTIFY_INFO構造体の要素aData配列は、PRINTER_NOTIFY_INFO_DATA構造体の配列で、ここでさらに印刷状態などを取得できる。
PRINTER_NOTIFY_INFO_DATA 構造体 (Winspool .h) - Win32 apps | Microsoft Docs
PRINTER_NOTIFY_INFO_DATA.cppで、
とする。
Microsoft Windows [Version 10.0.19043.1415] (c) Microsoft Corporation. All rights reserved. C:\Users\bg1>cd C:\Users\bg1\Documents\test C:\Users\bg1\Documents\test>PRINTER_NOTIFY_INFO_DATA.exe thread begin before. thread wait before. threadproc begin before. Default Printer: EPSON PX-S06 Series hPrinter: 0x005bc944 pTI->m_hHandles[0]: 0x00000114 pTI->m_hHandles[1]: 0x00000154 notify! PRINTER_CHANGE_SET_PRINTER_DRIVER notify! PRINTER_CHANGE_SET_PRINTER PRINTER_CHANGE_ADD_JOB pPNI->Version = 2 pPNI->Flags = 131072 pPNI->Count = 25 pPNI->aData[0].Id = 00000000 pPNI->aData[0].Type = 00000000 PRINTER_NOTIFY_TYPE PRINTER_NOTIFY_FIELD_CJOBS: 1 pPNI->aData[1].Id = 00000005 pPNI->aData[1].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PRINTER_NAME: EPSON PX-S06 Series pPNI->aData[2].Id = 00000005 pPNI->aData[2].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_MACHINE_NAME: \\DESKTOP-PUSH7HT pPNI->aData[3].Id = 00000005 pPNI->aData[3].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PORT_NAME: pPNI->aData[4].Id = 00000005 pPNI->aData[4].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_USER_NAME: bg1 pPNI->aData[5].Id = 00000005 pPNI->aData[5].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_NOTIFY_NAME: bg1 pPNI->aData[6].Id = 00000005 pPNI->aData[6].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_DATATYPE: NT EMF 1.008 pPNI->aData[7].Id = 00000005 pPNI->aData[7].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PRINT_PROCESSOR: winprint pPNI->aData[8].Id = 00000005 pPNI->aData[8].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PARAMETERS: pPNI->aData[9].Id = 00000005 pPNI->aData[9].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_DRIVER_NAME: EPSON PX-S06 Series pPNI->aData[10].Id = 00000005 pPNI->aData[10].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_DEVMODE pPNI->aData[11].Id = 00000005 pPNI->aData[11].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_SPOOLING pPNI->aData[12].Id = 00000005 pPNI->aData[12].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS_STRING: pPNI->aData[13].Id = 00000005 pPNI->aData[13].Type = 00000001 JOB_NOTIFY_TYPE pPNI->aData[14].Id = 00000005 pPNI->aData[14].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_DOCUMENT: test1.txt - ??? pPNI->aData[15].Id = 00000005 pPNI->aData[15].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PRIORITY: 1 pPNI->aData[16].Id = 00000005 pPNI->aData[16].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_POSITION: 1 pPNI->aData[17].Id = 00000005 pPNI->aData[17].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_SUBMITTED pPNI->aData[18].Id = 00000005 pPNI->aData[18].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_START_TIME: 00:00 pPNI->aData[19].Id = 00000005 pPNI->aData[19].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_UNTIL_TIME: 00:00 pPNI->aData[20].Id = 00000005 pPNI->aData[20].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_TIME: 00:00 pPNI->aData[21].Id = 00000005 pPNI->aData[21].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_TOTAL_PAGES: 0 pPNI->aData[22].Id = 00000005 pPNI->aData[22].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PAGES_PRINTED: 0 pPNI->aData[23].Id = 00000005 pPNI->aData[23].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_TOTAL_BYTES: 0 pPNI->aData[24].Id = 00000005 pPNI->aData[24].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_BYTES_PRINTED: 0 notify! PRINTER_CHANGE_SET_JOB PRINTER_CHANGE_WRITE_JOB pPNI->Version = 2 pPNI->Flags = 131072 pPNI->Count = 11 pPNI->aData[0].Id = 00000005 pPNI->aData[0].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_TOTAL_PAGES: 1 pPNI->aData[1].Id = 00000005 pPNI->aData[1].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_TOTAL_BYTES: 1164 pPNI->aData[2].Id = 00000005 pPNI->aData[2].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS pPNI->aData[3].Id = 00000005 pPNI->aData[3].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS pPNI->aData[4].Id = 00000005 pPNI->aData[4].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PORT_NAME: USB001 pPNI->aData[5].Id = 00000005 pPNI->aData[5].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_PRINTING pPNI->aData[6].Id = 00000005 pPNI->aData[6].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_PRINTING pPNI->aData[7].Id = 00000005 pPNI->aData[7].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS_STRING: pPNI->aData[8].Id = 00000005 pPNI->aData[8].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_PRINTING pPNI->aData[9].Id = 00000005 pPNI->aData[9].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PAGES_PRINTED: 0 pPNI->aData[10].Id = 00000005 pPNI->aData[10].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_BYTES_PRINTED: 0 notify! PRINTER_CHANGE_WRITE_JOB pPNI->Version = 2 pPNI->Flags = 131072 pPNI->Count = 2 pPNI->aData[0].Id = 00000005 pPNI->aData[0].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PAGES_PRINTED: 0 pPNI->aData[1].Id = 00000005 pPNI->aData[1].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_BYTES_PRINTED: 1076 notify! PRINTER_CHANGE_SET_JOB pPNI->Version = 2 pPNI->Flags = 131072 pPNI->Count = 1 pPNI->aData[0].Id = 00000005 pPNI->aData[0].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_PRINTING notify! PRINTER_CHANGE_SET_PRINTER PRINTER_CHANGE_SET_JOB PRINTER_CHANGE_DELETE_JOB pPNI->Version = 2 pPNI->Flags = 131072 pPNI->Count = 12 pPNI->aData[0].Id = 00000005 pPNI->aData[0].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_PRINTING pPNI->aData[1].Id = 00000005 pPNI->aData[1].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_DELETING JOB_STATUS_PRINTING pPNI->aData[2].Id = 00000005 pPNI->aData[2].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_DELETING JOB_STATUS_PRINTING pPNI->aData[3].Id = 00000005 pPNI->aData[3].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_DELETING JOB_STATUS_PRINTING pPNI->aData[4].Id = 00000005 pPNI->aData[4].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS_STRING: pPNI->aData[5].Id = 00000005 pPNI->aData[5].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_DELETING JOB_STATUS_PRINTING JOB_STATUS_PRINTED pPNI->aData[6].Id = 00000005 pPNI->aData[6].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PORT_NAME: pPNI->aData[7].Id = 00000005 pPNI->aData[7].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_DELETING JOB_STATUS_PRINTED pPNI->aData[8].Id = 00000005 pPNI->aData[8].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_PAGES_PRINTED: 1 pPNI->aData[9].Id = 00000005 pPNI->aData[9].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_BYTES_PRINTED: 1076 pPNI->aData[10].Id = 00000000 pPNI->aData[10].Type = 00000000 PRINTER_NOTIFY_TYPE PRINTER_NOTIFY_FIELD_CJOBS: 0 pPNI->aData[11].Id = 00000005 pPNI->aData[11].Type = 00000001 JOB_NOTIFY_TYPE JOB_NOTIFY_FIELD_STATUS JOB_STATUS_DELETING JOB_STATUS_PRINTED JOB_STATUS_DELETED threadproc after before. thread close before. C:\Users\bg1\Documents\test>
いろいろ出てきた。