using System; using Vanara.InteropServices; using static Vanara.PInvoke.Gdi32; namespace Vanara.PInvoke { public static partial class WinSpool { /// Indicates that some notifications had to be discarded. public const uint PRINTER_NOTIFY_INFO_DISCARDED = 0x01; /// Printer, job and print server access rights. [PInvokeData("winspool.h")] [Flags] public enum AccessRights : uint { /// Printing-specific authorization to cancel, pause, resume, or restart the job ([MS-DTYP] ACCESS_MASK Bit 27). JOB_ACCESS_ADMINISTER = 0x00000010, /// Printing-specific read rights for the spool file ([MS-DTYP] ACCESS_MASK Bit 26). JOB_ACCESS_READ = 0x00000020, /// /// Access rights for jobs combining RC (Read Control) of ACCESS_MASK with printing-specific JOB_ACCESS_ADMINISTER. /// This value MUST NOT be passed over the wire. If it is, the server SHOULD return ERROR_ACCESS_DENIED. /// JOB_EXECUTE = ACCESS_MASK.STANDARD_RIGHTS_EXECUTE | JOB_ACCESS_ADMINISTER, /// Access rights for jobs combining RC (Read Control) of ACCESS_MASK with printing-specific JOB_ACCESS_READ. JOB_READ = ACCESS_MASK.STANDARD_RIGHTS_READ | JOB_ACCESS_READ, /// /// Access rights for jobs combining RC (Read Control) of ACCESS_MASK with printing-specific JOB_ACCESS_ADMINISTER. /// This value MUST NOT be passed over the wire. If it is, the server SHOULD return ERROR_ACCESS_DENIED. /// JOB_WRITE = ACCESS_MASK.STANDARD_RIGHTS_WRITE | JOB_ACCESS_ADMINISTER, /// /// Access rights for printers to perform all administrative tasks and basic printing operations except SYNCHRONIZE ([MS-DTYP] /// ACCESS_MASK Bit 'SY'). Combines STANDARD_RIGHTS_REQUIRED (ACCESS_MASK Bits 'RC', 'DE', 'WD', 'WO'), JOB_ACCESS_ADMINISTER /// (ACCESS_MASK Bit 27), and JOB_ACCESS_READ (ACCESS_MASK Bit 26). /// JOB_ALL_ACCESS = ACCESS_MASK.STANDARD_RIGHTS_REQUIRED | JOB_ACCESS_ADMINISTER | JOB_ACCESS_READ, /// Printing-specific access rights for printers to perform administrative tasks ([MS-DTYP] ACCESS_MASK Bit 29). PRINTER_ACCESS_ADMINISTER = 0x00000004, /// /// Printing-specific access rights for printers to perform basic printing operations ([MS-DTYP] ACCESS_MASK Bit 28). /// PRINTER_ACCESS_USE = 0x00000008, /// Printing-specific access rights for printers to perform printer data management operations ([MS-DTYP] ACCESS_MASK /// Bit 25). PRINTER_ACCESS_MANAGE_LIMITED = 0x00000040, /// /// Access rights for printers to perform all administrative tasks and basic printing operations except synchronization. /// Combines WO (Write Owner), WD (Write DACL), RC (Read Control), and DE (Delete) of ACCESS_MASK with printing-specific /// PRINTER_ACCESS_ADMINISTER and printing-specific PRINTER_ACCESS_USE. /// PRINTER_ALL_ACCESS = ACCESS_MASK.STANDARD_RIGHTS_REQUIRED | PRINTER_ACCESS_ADMINISTER | PRINTER_ACCESS_USE, /// Access rights for printers combining RC (Read Control) of ACCESS_MASK with printing-specific PRINTER_ACCESS_USE. PRINTER_EXECUTE = ACCESS_MASK.STANDARD_RIGHTS_EXECUTE | PRINTER_ACCESS_USE, /// Access rights for printers combining RC (Read Control) of ACCESS_MASK with printing-specific PRINTER_ACCESS_USE. PRINTER_READ = ACCESS_MASK.STANDARD_RIGHTS_READ | PRINTER_ACCESS_USE, /// Access rights for printers combining RC (Read Control) of ACCESS_MASK with printing-specific PRINTER_ACCESS_USE. PRINTER_WRITE = ACCESS_MASK.STANDARD_RIGHTS_WRITE | PRINTER_ACCESS_USE, /// Printing-specific access rights to administer print servers ([MS-DTYP] ACCESS_MASK Bit 31). SERVER_ACCESS_ADMINISTER = 0x00000001, /// Printing-specific access rights to enumerate print servers ([MS-DTYP] ACCESS_MASK Bit 30). SERVER_ACCESS_ENUMERATE = 0x00000002, /// /// Access rights for print servers to perform all administrative tasks and basic printing operations except synchronization. /// Combines WO (Write Owner), WD (Write DACL), RC (Read Control), and DE (Delete) of ACCESS_MASK with printing-specific /// SERVER_ACCESS_ADMINISTER and printing-specific SERVER_ACCESS_ENUMERATE. /// SERVER_ALL_ACCESS = ACCESS_MASK.STANDARD_RIGHTS_REQUIRED | SERVER_ACCESS_ADMINISTER | SERVER_ACCESS_ENUMERATE, /// Access rights for print servers combining RC (Read Control) of ACCESS_MASK with printing-specific SERVER_ACCESS_ENUMERATE. SERVER_EXECUTE = ACCESS_MASK.STANDARD_RIGHTS_EXECUTE | SERVER_ACCESS_ENUMERATE, /// Access rights for print servers combining RC (Read Control) of ACCESS_MASK with printing-specific SERVER_ACCESS_ENUMERATE. SERVER_READ = ACCESS_MASK.STANDARD_RIGHTS_READ | SERVER_ACCESS_ENUMERATE, /// /// Access rights for print servers combining RC (Read Control) of ACCESS_MASK with printing-specific SERVER_ACCESS_ADMINISTER /// and printing-specific SERVER_ACCESS_ENUMERATE. /// SERVER_WRITE = ACCESS_MASK.STANDARD_RIGHTS_WRITE | SERVER_ACCESS_ADMINISTER | SERVER_ACCESS_ENUMERATE, } /// The capabilities to be queried. [PInvokeData("wingdi.h", MSDNShortId = "d7f63ef7-0a2e-47c3-9e81-6e8a6dffe9af")] public enum DC : uint { /// /// Returns the dmFields member of the printer driver's DEVMODE structure. The dmFields member indicates which members in the /// device-independent portion of the structure are supported by the printer driver. /// DC_FIELDS = 1, /// /// Retrieves a list of supported paper sizes. The pOutput buffer receives an array of WORD values that indicate the available /// paper sizes for the printer. The return value indicates the number of entries in the array. For a list of the possible array /// values, see the description of the dmPaperSize member of the DEVMODE structure. If pOutput is NULL, the return value /// indicates the required number of entries in the array. /// DC_PAPERS = 2, /// /// Retrieves the dimensions, in tenths of a millimeter, of each supported paper size. The pOutput buffer receives an array of /// POINT structures. Each structure contains the width (x-dimension) and length (y-dimension) of a paper size as if the paper /// were in the DMORIENT_PORTRAIT orientation. The return value indicates the number of entries in the array. /// DC_PAPERSIZE = 3, /// /// Returns the minimum paper size that the dmPaperLength and dmPaperWidth members of the printer driver's DEVMODE structure can /// specify. The LOWORD of the return value contains the minimum dmPaperWidth value, and the HIWORD contains the minimum /// dmPaperLength value. /// DC_MINEXTENT = 4, /// /// Returns the maximum paper size that the dmPaperLength and dmPaperWidth members of the printer driver's DEVMODE structure can /// specify. The LOWORD of the return value contains the maximum dmPaperWidth value, and the HIWORD contains the maximum /// dmPaperLength value. /// DC_MAXEXTENT = 5, /// /// Retrieves a list of available paper bins. The pOutput buffer receives an array of WORD values that indicate the available /// paper sources for the printer. The return value indicates the number of entries in the array. For a list of the possible /// array values, see the description of the dmDefaultSource member of the DEVMODE structure. If pOutput is NULL, the return /// value indicates the required number of entries in the array. /// DC_BINS = 6, /// /// If the printer supports duplex printing, the return value is 1; otherwise, the return value is zero. The pOutput parameter /// is not used. /// DC_DUPLEX = 7, /// Returns the dmSize member of the printer driver's DEVMODE structure. DC_SIZE = 8, /// /// Returns the number of bytes required for the device-specific portion of the DEVMODE structure for the printer driver. /// DC_EXTRA = 9, /// Returns the specification version to which the printer driver conforms. DC_VERSION = 10, /// Returns the version number of the printer driver. DC_DRIVER = 11, /// /// Retrieves the names of the printer's paper bins. The pOutput buffer receives an array of string buffers. Each string buffer /// is 24 characters long and contains the name of a paper bin. The return value indicates the number of entries in the array. /// The name strings are null-terminated unless the name is 24 characters long. If pOutput is NULL, the return value is the /// number of bin entries required. /// DC_BINNAMES = 12, /// /// Retrieves a list of the resolutions supported by the printer. The pOutput buffer receives an array of LONG values. For each /// supported resolution, the array contains a pair of LONG values that specify the x and y dimensions of the resolution, in /// dots per inch. The return value indicates the number of supported resolutions. If pOutput is NULL, the return value /// indicates the number of supported resolutions. /// DC_ENUMRESOLUTIONS = 13, /// /// Retrieves the names of any additional files that need to be loaded when a driver is installed. The pOutput buffer receives /// an array of string buffers. Each string buffer is 64 characters long and contains the name of a file. The return value /// indicates the number of entries in the array. The name strings are null-terminated unless the name is 64 characters long. If /// pOutput is NULL, the return value is the number of files. /// DC_FILEDEPENDENCIES = 14, /// /// Retrieves the abilities of the driver to use TrueType fonts. For DC_TRUETYPE, the pOutput parameter should be NULL. The /// return value can be one or more of the following: DCTT_BITMAP Device can print TrueType fonts as graphics. DCTT_DOWNLOAD /// Device can download TrueType fonts. DCTT_SUBDEV Device can substitute device fonts for TrueType fonts. /// DC_TRUETYPE = 15, /// /// Retrieves a list of supported paper names (for example, Letter or Legal). The pOutput buffer receives an array of string /// buffers. Each string buffer is 64 characters long and contains the name of a paper form. The return value indicates the /// number of entries in the array. The name strings are null-terminated unless the name is 64 characters long. If pOutput is /// NULL, the return value is the number of paper forms. /// DC_PAPERNAMES = 16, /// /// Returns the relationship between portrait and landscape orientations for a device, in terms of the number of degrees that /// portrait orientation is rotated counterclockwise to produce landscape orientation. The return value can be one of the /// following: 0 No landscape orientation. 90 Portrait is rotated 90 degrees to produce landscape. 270 Portrait is rotated 270 /// degrees to produce landscape. /// DC_ORIENTATION = 17, /// Returns the number of copies the device can print. DC_COPIES = 18, /// Not used for NT-based operating systems. DC_BINADJUST = 19, /// Not used for NT-based operating systems. DC_EMF_COMPLIANT = 20, /// Not used for NT-based operating systems. DC_DATATYPE_PRODUCED = 21, /// /// If the printer supports collating, the return value is 1; otherwise, the return value is zero. The pOutput parameter is not used. /// DC_COLLATE = 22, /// Not used for NT-based operating systems. DC_MANUFACTURER = 23, /// Not used for NT-based operating systems. DC_MODEL = 24, /// /// Retrieves a list of printer description languages supported by the printer. The pOutput buffer receives an array of string /// buffers. Each buffer is 32 characters long and contains the name of a printer description language. The return value /// indicates the number of entries in the array. The name strings are null-terminated unless the name is 32 characters long. If /// pOutput is NULL, the return value indicates the required number of array entries. /// DC_PERSONALITY = 25, /// /// The return value indicates the printer's print rate. The value returned for DC_PRINTRATEUNIT indicates the units of the /// DC_PRINTRATE value. The pOutput parameter is not used. /// DC_PRINTRATE = 26, /// /// The return value is one of the following values that indicate the print rate units for the value returned for the /// DC_PRINTRATE flag. The pOutput parameter is not used. PRINTRATEUNIT_CPS Characters per second. PRINTRATEUNIT_IPM Inches per /// minute. PRINTRATEUNIT_LPM Lines per minute. PRINTRATEUNIT_PPM Pages per minute. /// DC_PRINTRATEUNIT = 27, /// The return value is the amount of available printer memory, in kilobytes. The pOutput parameter is not used. DC_PRINTERMEM = 28, /// /// Retrieves the names of the paper forms that are currently available for use. The pOutput buffer receives an array of string /// buffers. Each string buffer is 64 characters long and contains the name of a paper form. The return value indicates the /// number of entries in the array. The name strings are null-terminated unless the name is 64 characters long. If pOutput is /// NULL, the return value is the number of paper forms. /// DC_MEDIAREADY = 29, /// /// If the printer supports stapling, the return value is a nonzero value; otherwise, the return value is zero. The pOutput /// parameter is not used. /// DC_STAPLE = 30, /// The return value indicates the printer's print rate, in pages per minute. The pOutput parameter is not used. DC_PRINTRATEPPM = 31, /// /// If the printer supports color printing, the return value is 1; otherwise, the return value is zero. The pOutput parameter is /// not used. /// DC_COLORDEVICE = 32, /// /// Retrieves an array of integers that indicate that printer's ability to print multiple document pages per printed page. The /// pOutput buffer receives an array of DWORD values. Each value represents a supported number of document pages per printed /// page. The return value indicates the number of entries in the array. If pOutput is NULL, the return value indicates the /// required number of entries in the array. /// DC_NUP = 33, /// /// Retrieves the names of the supported media types. The pOutput buffer receives an array of string buffers. Each string buffer /// is 64 characters long and contains the name of a supported media type. The return value indicates the number of entries in /// the array. The strings are null-terminated unless the name is 64 characters long. If pOutput is NULL, the return value is /// the number of media type names required. /// DC_MEDIATYPENAMES = 34, /// /// Retrieves a list of supported media types. The pOutput buffer receives an array of DWORD values that indicate the supported /// media types. The return value indicates the number of entries in the array. For a list of possible array values, see the /// description of the dmMediaType member of the DEVMODE structure. If pOutput is NULL, the return value indicates the required /// number of entries in the array. /// DC_MEDIATYPES = 35, } /// Device mode flags. [PInvokeData("winspool.h", MSDNShortId = "e89a2f6f-2bac-4369-b526-f8e15028698b")] [Flags] public enum DM { /// /// When used, the DocumentProperties function returns the number of bytes required by the printer driver's DEVMODE data structure. /// DM_SIZEOF = 0, /// DM_UPDATE = 1, /// DM_COPY = 2, /// DM_PROMPT = 4, /// DM_MODIFY = 8, /// No description available. DM_OUT_DEFAULT = DM_UPDATE, /// /// Output value. The function writes the printer driver's current print settings, including private data, to the DEVMODE data /// structure specified by the pDevModeOutput parameter. The caller must allocate a buffer sufficiently large to contain the /// information. If the bit DM_OUT_BUFFER sets is clear, the pDevModeOutput parameter can be NULL. This value is also defined as . /// DM_OUT_BUFFER = DM_COPY, /// /// Input value. The function presents the printer driver's Print Setup property sheet and then changes the settings in the /// printer's DEVMODE data structure to those values specified by the user. This value is also defined as . /// DM_IN_PROMPT = DM_PROMPT, /// /// Input value. Before prompting, copying, or updating, the function merges the printer driver's current print settings with /// the settings in the DEVMODE structure specified by the pDevModeInput parameter. The function updates the structure only for /// those members specified by the DEVMODE structure's dmFields member. This value is also defined as . /// In cases of conflict during the merge, the settings in the DEVMODE structure specified by pDevModeInput override the printer /// driver's current print settings. /// DM_IN_BUFFER = DM_MODIFY, } /// An escape code that identifies the event to be handled. [PInvokeData("winspool.h", MSDNShortId = "1250116e-55c7-470f-97f6-36f27a31a841")] public enum DOCUMENTEVENT { /// GDI is about to process a call to its CreateDC or CreateIC function. //[CorrespondingType(typeof(DOCEVENT_CREATEDPRE), CorrespondingAction.Set)] [CorrespondingType(typeof(DEVMODE), CorrespondingAction.Get)] DOCUMENTEVENT_CREATEDCPRE = 1, /// /// GDI has just processed a call to its CreateDC or CreateIC function. /// This escape code should not be used unless there has been a previous call to DocumentEvent with iEsc set to DOCUMENTEVENT_CREATEDCPRE. /// [CorrespondingType(typeof(DEVMODE), CorrespondingAction.Set)] DOCUMENTEVENT_CREATEDCPOST = 2, /// GDI is about to process a call to its ResetDC function. [CorrespondingType(typeof(DEVMODE), CorrespondingAction.GetSet)] DOCUMENTEVENT_RESETDCPRE = 3, /// /// GDI has just processed a call to its ResetDC function. /// This escape code should not be used unless there has been a previous call to DocumentEvent with iEsc set to DOCUMENTEVENT_RESETDCPRE. /// [CorrespondingType(typeof(DEVMODE), CorrespondingAction.Set)] DOCUMENTEVENT_RESETDCPOST = 4, /// GDI is about to process a call to its StartDoc function. [CorrespondingType(typeof(DOCINFO), CorrespondingAction.Set)] DOCUMENTEVENT_STARTDOC = 5, /// GDI is about to process a call to its StartDoc function. [CorrespondingType(typeof(DOCINFO), CorrespondingAction.Set)] DOCUMENTEVENT_STARTDOCPRE = 5, /// GDI is about to process a call to its StartPage function. DOCUMENTEVENT_STARTPAGE = 6, /// GDI is about to process a call to its EndPage function. DOCUMENTEVENT_ENDPAGE = 7, /// GDI is about to process a call to its EndDoc function. DOCUMENTEVENT_ENDDOC = 8, /// GDI is about to process a call to its EndDoc function. DOCUMENTEVENT_ENDDOCPRE = 8, /// GDI is about to process a call to its AbortDoc function. DOCUMENTEVENT_ABORTDOC = 9, /// GDI is about to process a call to its DeleteDC function. DOCUMENTEVENT_DELETEDC = 10, /// GDI is about to process a call to its ExtEscape function. //[CorrespondingType(typeof(DOCEVENT_ESCAPE), CorrespondingAction.Set)] DOCUMENTEVENT_ESCAPE = 11, /// GDI has just processed a call to its EndDoc function. DOCUMENTEVENT_ENDDOCPOST = 12, /// GDI has just processed a call to its StartDoc function. [CorrespondingType(typeof(int), CorrespondingAction.Set)] DOCUMENTEVENT_STARTDOCPOST = 13, /// /// The DOCUMENTEVENT_QUERYFILTER event represents an opportunity for the spooler to query the driver for a list of the /// DOCUMENTEVENT_ XXX events to which the driver will respond. This event is issued just prior to a call to DocumentEvent that /// passes the DOCUMENTEVENT_CREATEDCPRE event. /// //[CorrespondingType(typeof(DOCEVENT_CREATEDPRE), CorrespondingAction.Set)] //[CorrespondingType(typeof(DOCEVENT_FILTER), CorrespondingAction.Get)] DOCUMENTEVENT_QUERYFILTER = 14, } /// /// Indicates the action for the SetPrinter function to perform. For the GetPrinter function, this member indicates /// whether the specified printer is published. /// [PInvokeData("winspool.h", MSDNShortId = "9443855e-df7d-41a1-a0df-5649a97b2915")] [Flags] public enum DSPRINT : uint { /// /// GetPrinter: Indicates that the system is attempting to complete a publish or unpublish operation started by a SetPrinter call. /// SetPrinter: This value is not valid. /// DSPRINT_PENDING = 0x80000000, /// /// SetPrinter: Publishes the printer's data in the DS. /// GetPrinter: Indicates the printer is published. /// DSPRINT_PUBLISH = 0x00000001, /// /// SetPrinter: The DS data for the printer is unpublished and then published again, refreshing all properties in the published /// printer. Re-publishing also changes the GUID of the published printer. /// GetPrinter: Never returns this value. /// DSPRINT_REPUBLISH = 0x00000008, /// /// SetPrinter: Removes the printer's published data from the DS. /// GetPrinter: Indicates the printer is not published. /// DSPRINT_UNPUBLISH = 0x00000004, /// /// SetPrinter: Updates the printer's published data in the DS. /// GetPrinter: Never returns this value. /// DSPRINT_UPDATE = 0x00000002, } /// /// The EPrintPropertyType enumeration defines the data types for different printing properties. /// // https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-par/9c30d688-be09-4a19-9e41-cb21a55f3884 [PInvokeData("winspool.h")] public enum EPrintPropertyType { /// The data type is string. kPropertyTypeString = 1, /// The data type is a 32-bit signed integer. kPropertyTypeInt32, /// The data type is a 64-bit signed integer. kPropertyTypeInt64, /// The data type is a BYTE. kPropertyTypeByte, /// The data type is SYSTEMTIME_CONTAINER, as specified in [MS-RPRN] section 2.2.1.2.16. kPropertyTypeTime, /// The data type is DEVMODE_CONTAINER, as specified in [MS-RPRN] section 2.2.1.2.1. kPropertyTypeDevMode, /// The data type is SECURITY_CONTAINER, as specified in [MS-RPRN] section 2.2.1.2.13. kPropertyTypeSD, /// The data type is NOTIFY_REPLY_CONTAINER, as specified in section 2.2.7. kPropertyTypeNotificationReply, /// The data type is NOTIFY_OPTIONS_CONTAINER, as specified in section 2.2.6. kPropertyTypeNotificationOptions } /// Specifies whether an XPS print job is in the spooling or the rendering phase. /// This enumeration is primarily used as a parameter for the ReportJobProcessingProgress function. // https://docs.microsoft.com/en-us/windows/win32/printdocs/eprintxpsjoboperation typedef enum tagEPrintXPSJobOperation { // kJobProduction, kJobConsumption } EPrintXPSJobOperation; [PInvokeData("Winspool.h", MSDNShortId = "14871d29-59e4-45a2-9697-12550c58396c")] public enum EPrintXPSJobOperation { /// The XPS job is spooling. kJobProduction = 1, /// The XPS job is rendering. kJobConsumption, } /// Specifies what the spooler is currently doing as it processes an XPS print job. /// /// This enumeration is primarily used as a parameter for the ReportJobProcessingProgress function. /// These values can refer to either the spooling or the rendering phase of a print job. /// // https://docs.microsoft.com/en-us/windows/win32/printdocs/eprintxpsjobprogress typedef enum tagEPrintXPSJobProgress { // kAddingDocumentSequence, kDocumentSequenceAdded, kAddingFixedDocument, kFixedDocumentAdded, kAddingFixedPage, kFixedPageAdded, // kResourceAdded, kFontAdded, kImageAdded, kXpsDocumentCommitted } EPrintXPSJobProgress; [PInvokeData("Winspool.h", MSDNShortId = "4fa5b749-e4f9-4f08-97b5-e58f82d0b485")] public enum EPrintXPSJobProgress { /// A document sequence is about to be added to the XPS job. kAddingDocumentSequence, /// A document sequence has been added to the XPS job. kDocumentSequenceAdded, /// A fixed document is about to be added to the XPS job. kAddingFixedDocument, /// A fixed document has been added to the XPS job. kFixedDocumentAdded, /// A page is about to be added to the XPS job. kAddingFixedPage, /// A page has been added to the XPS job. kFixedPageAdded, /// A resource had been added to the XPS job. kResourceAdded, /// A font has been added to the XPS job. kFontAdded, /// An image has been added to the XPS job. kImageAdded, /// The data for the XPS job has been committed. kXpsDocumentCommitted, } /// The form properties. [PInvokeData("winspool.h", MSDNShortId = "1c42ea6c-82cf-463c-bc67-44a8d8c4a1e7")] public enum FormFlags { /// /// If this bit flag is set, the form has been defined by the user. Forms with this flag set are defined in the registry. /// FORM_USER, /// /// If this bit-flag is set, the form is part of the spooler. Form definitions with this flag set do not appear in the registry. /// FORM_BUILTIN, /// If this bit flag is set, the form is associated with a certain printer, and its definition appears in the registry. FORM_PRINTER } /// Specifies how a localized display name for the form is obtained at runtime. [PInvokeData("winspool.h")] [Flags] public enum FormStringType { /// There is no localized display name. STRING_NONE = 0x00000001, /// /// The display name is extracted from the Multilingual User Interface localized resources DLL specified in pMuiDll. The ID is /// in the dwResourceId member. /// STRING_MUIDLL = 0x00000002, /// The display name and language ID are provided directly by pDisplayName and the language is specified by wLangId. STRING_LANGPAIR = 0x00000004 } /// The print job operation to perform. [PInvokeData("winspool.h")] public enum JOB_CONTROL { /// Pause the print job. JOB_CONTROL_PAUSE = 1, /// Resume a paused print job. JOB_CONTROL_RESUME = 2, /// Do not use. To delete a print job, use JOB_CONTROL_DELETE. JOB_CONTROL_CANCEL = 3, /// Restart the print job. A job can only be restarted if it was printing. JOB_CONTROL_RESTART = 4, /// Delete the print job. JOB_CONTROL_DELETE = 5, /// Used by port monitors to end the print job. JOB_CONTROL_SENT_TO_PRINTER = 6, /// Used by language monitors to end the print job. JOB_CONTROL_LAST_PAGE_EJECTED = 7, /// Windows Vista and later: Keep the job in the queue after it prints. JOB_CONTROL_RETAIN = 8, /// Windows Vista and later: Release the print job. JOB_CONTROL_RELEASE = 9, } /// /// Possible values for when is . /// [PInvokeData("winspool.h", MSDNShortId = "7a7b9e01-32e0-47f8-a5b1-5f7e6a663714")] public enum JOB_NOTIFY_FIELD : ushort { /// pBuf is a pointer to a null-terminated string containing the name of the printer for which the job is spooled. JOB_NOTIFY_FIELD_PRINTER_NAME = 0x00, /// /// pBuf is a pointer to a null-terminated string that specifies the name of the machine that created the print job. /// JOB_NOTIFY_FIELD_MACHINE_NAME = 0x01, /// /// pBuf is a pointer to a null-terminated string that identifies the port(s) used to transmit data to the printer. If a printer /// is connected to more than one port, the names of the ports are separated by commas (for example, "LPT1:,LPT2:,LPT3:"). /// JOB_NOTIFY_FIELD_PORT_NAME = 0x02, /// pBuf is a pointer to a null-terminated string that specifies the name of the user who sent the print job. JOB_NOTIFY_FIELD_USER_NAME = 0x03, /// /// pBuf is a pointer to a null-terminated string that specifies the name of the user who should be notified when the job has /// been printed or when an error occurs while printing the job. /// JOB_NOTIFY_FIELD_NOTIFY_NAME = 0x04, /// pBuf is a pointer to a null-terminated string that specifies the type of data used to record the print job. JOB_NOTIFY_FIELD_DATATYPE = 0x05, /// /// pBuf is a pointer to a null-terminated string that specifies the name of the print processor to be used to print the job. /// JOB_NOTIFY_FIELD_PRINT_PROCESSOR = 0x06, /// pBuf is a pointer to a null-terminated string that specifies print-processor parameters. JOB_NOTIFY_FIELD_PARAMETERS = 0x07, /// /// pBuf is a pointer to a null-terminated string that specifies the name of the printer driver that should be used to process /// the print job. /// JOB_NOTIFY_FIELD_DRIVER_NAME = 0x08, /// /// pBuf is a pointer to a DEVMODE structure that contains device-initialization and environment data for the printer driver. /// JOB_NOTIFY_FIELD_DEVMODE = 0x09, /// adwData [0] specifies the job status. For a list of possible values, see the JOB_INFO_2 structure. JOB_NOTIFY_FIELD_STATUS = 0x0A, /// pBuf is a pointer to a null-terminated string that specifies the status of the print job. JOB_NOTIFY_FIELD_STATUS_STRING = 0x0B, /// Not supported. JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR = 0x0C, /// /// pBuf is a pointer to a null-terminated string that specifies the name of the print job (for example, "MS-WORD: Review.doc"). /// JOB_NOTIFY_FIELD_DOCUMENT = 0x0D, /// adwData [0] specifies the job priority. JOB_NOTIFY_FIELD_PRIORITY = 0x0E, /// adwData [0] specifies the job's position in the print queue. JOB_NOTIFY_FIELD_POSITION = 0x0F, /// pBuf is a pointer to a SYSTEMTIME structure that specifies the time when the job was submitted. JOB_NOTIFY_FIELD_SUBMITTED = 0x10, /// /// adwData [0] specifies the earliest time that the job can be printed. (This value is specified in minutes elapsed since 12:00 A.M.) /// JOB_NOTIFY_FIELD_START_TIME = 0x11, /// /// adwData [0] specifies the latest time that the job can be printed. (This value is specified in minutes elapsed since 12:00 A.M.) /// JOB_NOTIFY_FIELD_UNTIL_TIME = 0x12, /// adwData [0] specifies the total time, in seconds, that has elapsed since the job began printing. JOB_NOTIFY_FIELD_TIME = 0x13, /// adwData [0] specifies the size, in pages, of the job. JOB_NOTIFY_FIELD_TOTAL_PAGES = 0x14, /// adwData [0] specifies the number of pages that have printed. JOB_NOTIFY_FIELD_PAGES_PRINTED = 0x15, /// adwData [0] specifies the size, in bytes, of the job. JOB_NOTIFY_FIELD_TOTAL_BYTES = 0x16, /// /// adwData [0] specifies the number of bytes that have been printed on this job. For this field, the change notification object /// is signaled when bytes are sent to the printer. /// JOB_NOTIFY_FIELD_BYTES_PRINTED = 0x17, /// JOB_NOTIFY_FIELD_REMOTE_JOB_ID = 0x18, } /// The job priority. [PInvokeData("winspool.h", MSDNShortId = "d42ada89-6bc7-4006-81d9-dbcc0347edd3")] public enum JOB_PRIORITY { /// No priority. NO_PRIORITY = 0, /// The maximum priority/ MAX_PRIORITY = 99, /// The minimum priority. MIN_PRIORITY = 1, /// The default priority. DEF_PRIORITY = 1, } /// The job status. [PInvokeData("winspool.h", MSDNShortId = "d42ada89-6bc7-4006-81d9-dbcc0347edd3")] public enum JOB_STATUS : uint { /// The job is paused. JOB_STATUS_PAUSED = 0x00000001, /// An error is associated with the job. JOB_STATUS_ERROR = 0x00000002, /// Job is being deleted. JOB_STATUS_DELETING = 0x00000004, /// The job is spooling. JOB_STATUS_SPOOLING = 0x00000008, /// The job is printing. JOB_STATUS_PRINTING = 0x00000010, /// Printer is offline. JOB_STATUS_OFFLINE = 0x00000020, /// Printer is out of paper. JOB_STATUS_PAPEROUT = 0x00000040, /// Job has printed. JOB_STATUS_PRINTED = 0x00000080, /// Job has been deleted. JOB_STATUS_DELETED = 0x00000100, /// The driver cannot print the job. JOB_STATUS_BLOCKED_DEVQ = 0x00000200, /// Printer has an error that requires the user to do something. JOB_STATUS_USER_INTERVENTION = 0x00000400, /// Job has been restarted. JOB_STATUS_RESTART = 0x00000800, /// /// Windows XP and later: Job is sent to the printer, but the job may not be printed yet. /// See Remarks for more information. /// JOB_STATUS_COMPLETE = 0x00001000, /// /// /// Windows Vista and later: Job has been retained in the print queue and cannot be deleted. This can be caused by the following: /// /// /// The job was manually retained by a call to SetJob and the spooler is waiting for the job to be released. /// The job has not finished printing and must finish printing before it can be automatically deleted. /// /// See SetJob for more information about print job commands. /// JOB_STATUS_RETAINED = 0x00002000, /// JOB_STATUS_RENDERING_LOCALLY = 0x00004000, } /// Indicates the type of information provided by . [PInvokeData("winspool.h", MSDNShortId = "7a7b9e01-32e0-47f8-a5b1-5f7e6a663714")] public enum NOTIFY_TYPE : ushort { /// Indicates that the Field member specifies a JOB_NOTIFY_FIELD_* constant. JOB_NOTIFY_TYPE = 0x01, /// Indicates that the Field member specifies a PRINTER_NOTIFY_FIELD_* constant. PRINTER_NOTIFY_TYPE = 0x00, } /// The new port status. [PInvokeData("winspool.h", MSDNShortId = "0939353f-284b-4dbb-89a2-04918c934430")] public enum PORT_STATUS { /// Clears the printer port status. PORT_STATUS_CLEAR = 0x00000000, /// The port’s printer is offline. PORT_STATUS_OFFLINE = 0x00000001, /// The port’s printer has a paper jam. PORT_STATUS_PAPER_JAM = 0x00000002, /// The port’s printer is out of paper. PORT_STATUS_PAPER_OUT = 0x00000003, /// The port’s printer's output bin is full. PORT_STATUS_OUTPUT_BIN_FULL = 0x00000004, /// The port’s printer has a paper problem. PORT_STATUS_PAPER_PROBLEM = 0x00000005, /// The port’s printer is out of toner. PORT_STATUS_NO_TONER = 0x00000006, /// The door of the port’s printer is open. PORT_STATUS_DOOR_OPEN = 0x00000007, /// The port’s printer requires user intervention. PORT_STATUS_USER_INTERVENTION = 0x00000008, /// The port’s printer is out of memory. PORT_STATUS_OUT_OF_MEMORY = 0x00000009, /// The port’s printer is low on toner. PORT_STATUS_TONER_LOW = 0x0000000A, /// The port’s printer is warming up. PORT_STATUS_WARMING_UP = 0x0000000B, /// The port’s printer is in a power-conservation mode. PORT_STATUS_POWER_SAVE = 0x0000000C, } /// The severity of the port status value. [PInvokeData("winspool.h", MSDNShortId = "0939353f-284b-4dbb-89a2-04918c934430")] public enum PORT_STATUS_TYPE { /// The port status value indicates an error. PORT_STATUS_TYPE_ERROR = 0x00000001, /// The port status value is a warning. PORT_STATUS_TYPE_WARNING = 0x00000002, /// The port status value is informational. PORT_STATUS_TYPE_INFO = 0x00000003, } /// A bit field that specifies attributes of the printer port. [PInvokeData("winspool.h", MSDNShortId = "93675294-61d4-40e4-b84c-f252978e0285")] [Flags] public enum PORT_TYPE { /// The port can be written to. PORT_TYPE_WRITE = 0x00000001, /// The port can be read from. PORT_TYPE_READ = 0x00000002, /// The port is a Terminal Services redirected port. PORT_TYPE_REDIRECTED = 0x00000004, /// The port is a network TCP/IP port. PORT_TYPE_NET_ATTACHED = 0x00000008, } /// Print processor border options. [PInvokeData("winspool.h", MSDNShortId = "70120739-a4e0-4b87-ac7a-40a42fb509ee")] [Flags] public enum PPCAPS_BORDER { /// /// Indicates that when multiple document pages are being printed on a single side of a physical sheet, the printer can be told /// whether or not to print a border around the imageable area of each document page. /// PPCAPS_BORDER_PRINT = 0x00000001, } /// The available patterns when multiple document pages are printed on the same side of a sheet of paper. [PInvokeData("winspool.h", MSDNShortId = "70120739-a4e0-4b87-ac7a-40a42fb509ee")] [Flags] public enum PPCAPS_DIRECTION { /// Pages appear in rows from right to left, each subsequent row below its predecessor. PPCAPS_RIGHT_THEN_DOWN = 0x00000001, /// Pages appear in columns from top to bottom, each subsequent column to the right of its predecessor. PPCAPS_DOWN_THEN_RIGHT = 0x00000001 << 1, /// Pages appear in rows from left to right, each subsequent row below its predecessor. PPCAPS_LEFT_THEN_DOWN = 0x00000001 << 2, /// Pages appear in columns from top to bottom, each subsequent column to the left of its predecessor. PPCAPS_DOWN_THEN_LEFT = 0x00000001 << 3, } /// Print processor duplux handling options. [PInvokeData("winspool.h", MSDNShortId = "70120739-a4e0-4b87-ac7a-40a42fb509ee")] [Flags] public enum PPCAPS_DUPLEX { /// /// When printing in reverse order and duplexing, the processor can print swap the order of each pair of pages, so instead of /// printing in order 4,3,2,1, they will print in the order 3,4,1,2. /// PPCAPS_REVERSE_PAGES_FOR_REVERSE_DUPLEX = 0x00000001, /// /// When duplexing, the Print Processor can be told not to send an extra page when there is an odd number of document pages. The /// processor will honor the value as best as it can, but in cases where preventing an extra blank page would cause improper /// output, the extra pages may still be sent. /// PPCAPS_DONT_SEND_EXTRA_PAGES_FOR_DUPLEX = 0x00000002 } /// Print processor booklet handling. [PInvokeData("winspool.h", MSDNShortId = "70120739-a4e0-4b87-ac7a-40a42fb509ee")] [Flags] public enum PPCAPS_EDGE { /// Indicates that the printer can print booklet style. PPCAPS_BOOKLET_EDGE = 0x00000001, } /// Print processor scaling options. [PInvokeData("winspool.h", MSDNShortId = "70120739-a4e0-4b87-ac7a-40a42fb509ee")] [Flags] public enum PPCAPS_SCALING { /// Indicates that the printer can scale the page image. PPCAPS_SQUARE_SCALING = 0x00000001, } /// Represents the execution context when GetPrintExecutionData is called. // https://docs.microsoft.com/en-us/windows/win32/printdocs/print-execution-context typedef enum PRINT_EXECUTION_CONTEXT; [PInvokeData("Winspool.h", MSDNShortId = "b6c026b2-8519-45d3-9614-b502eec23cde")] public enum PRINT_EXECUTION_CONTEXT { /// The caller is running in an application. PRINT_EXECUTION_CONTEXT_APPLICATION = 0, /// The caller is running in the spooler service (spoolsv.exe). PRINT_EXECUTION_CONTEXT_SPOOLER_SERVICE = 1, /// The caller is running in the print isolation host (PrintIsolationHost.exe) PRINT_EXECUTION_CONTEXT_SPOOLER_ISOLATION_HOST = 2, /// The caller is running in the print filter pipeline (printfilterpipelinesvc.exe) PRINT_EXECUTION_CONTEXT_FILTER_PIPELINE = 3, /// The caller is running in splwow64.exe PRINT_EXECUTION_CONTEXT_WOW64 = 4, } /// The printer attributes. [PInvokeData("winspool.h", MSDNShortId = "944cbfcd-9edf-4b60-a45c-9bb1839f8141")] [Flags] public enum PRINTER_ATTRIBUTE { /// Indicates the printer is the default printer in the system. PRINTER_ATTRIBUTE_DEFAULT = 0x00000004, /// Job is sent directly to the printer (it is not spooled). PRINTER_ATTRIBUTE_DIRECT = 0x00000002, /// If set and printer is set for print-while-spooling, any jobs that have completed spooling are scheduled to print /// before jobs that have not completed spooling. PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST = 0x00000200, /// Indicates whether bidirectional communications are enabled for the printer. PRINTER_ATTRIBUTE_ENABLE_BIDI = 0x00000800, /// Setting this flag causes mismatched documents to be held in the queue. PRINTER_ATTRIBUTE_ENABLE_DEVQ = 0x00000080, /// If set, printer is a fax printer. PRINTER_ATTRIBUTE_FAX = 0x00004000, /// If set, jobs are kept after they are printed. If cleared, jobs are deleted. PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS = 0x00000100, /// Printer is a local printer. PRINTER_ATTRIBUTE_LOCAL = 0x00000040, /// Printer is a network printer connection. PRINTER_ATTRIBUTE_NETWORK = 0x00000010, /// Indicates whether the printer is published in the directory service (DS). PRINTER_ATTRIBUTE_PUBLISHED = 0x00002000, /// /// If set, the printer spools and starts printing after the last page is spooled. If cleared, and PRINTER_ATTRIBUTE_DIRECT is /// not set, the printer spools and prints while spooling. /// PRINTER_ATTRIBUTE_QUEUED = 0x00000001, /// Indicates that only RAW data type print jobs MUST be spooled. PRINTER_ATTRIBUTE_RAW_ONLY = 0x00001000, /// Printer is shared. PRINTER_ATTRIBUTE_SHARED = 0x00000008, /// Printer is a redirected terminal server printer. PRINTER_ATTRIBUTE_TS = 0x00008000, /// Indicates whether the printer is currently connected. If the printer is not currently connected, print jobs /// continue to spool. PRINTER_ATTRIBUTE_WORK_OFFLINE = 0x00000400, /// Reserved. PRINTER_ATTRIBUTE_HIDDEN = 0x00000020, /// The printer was installed by using the Push Printer Connections user policy. PRINTER_ATTRIBUTE_PUSHED_USER = 0x00020000, /// The printer was installed by using the Push Printer Connections computer policy. PRINTER_ATTRIBUTE_PUSHED_MACHINE = 0x00040000, /// Printer is a per-machine connection. PRINTER_ATTRIBUTE_MACHINE = 0x00080000, /// A computer has connected to this printer and given it a friendly name. PRINTER_ATTRIBUTE_FRIENDLY_NAME = 0x00100000, /// PRINTER_ATTRIBUTE_TS_GENERIC_DRIVER = 0x00200000, /// PRINTER_ATTRIBUTE_PER_USER = 0x00400000, /// PRINTER_ATTRIBUTE_ENTERPRISE_CLOUD = 0x00800000, } /// /// The conditions that will cause the change notification object to enter a signaled state. A change notification occurs when one /// or more of the specified conditions are met. /// [PInvokeData("", MSDNShortId = "4155ef5c-cd96-4960-919b-d9a495bb73a5")] [Flags] public enum PRINTER_CHANGE : uint { /// A printer was added to the server. PRINTER_CHANGE_ADD_PRINTER = 0x00000001, /// A printer was set. PRINTER_CHANGE_SET_PRINTER = 0x00000002, /// A printer was deleted. PRINTER_CHANGE_DELETE_PRINTER = 0x00000004, /// A printer connection has failed. PRINTER_CHANGE_FAILED_CONNECTION_PRINTER = 0x00000008, /// /// Notify of any changes to a printer. You can set this general flag or one or more of the following specific flags: /// PRINTER_CHANGE_ADD_PRINTER PRINTER_CHANGE_SET_PRINTER PRINTER_CHANGE_DELETE_PRINTER PRINTER_CHANGE_FAILED_CONNECTION_PRINTER /// PRINTER_CHANGE_PRINTER = 0x000000FF, /// A print job was sent to the printer. PRINTER_CHANGE_ADD_JOB = 0x00000100, /// A job was set. PRINTER_CHANGE_SET_JOB = 0x00000200, /// A job was deleted. PRINTER_CHANGE_DELETE_JOB = 0x00000400, /// Job data was written. PRINTER_CHANGE_WRITE_JOB = 0x00000800, /// /// Notify of any changes to a job. You can set this general flag or one or more of the following specific flags: /// PRINTER_CHANGE_ADD_JOB PRINTER_CHANGE_SET_JOB PRINTER_CHANGE_DELETE_JOB PRINTER_CHANGE_WRITE_JOB /// PRINTER_CHANGE_JOB = 0x0000FF00, /// A form was added to the server. PRINTER_CHANGE_ADD_FORM = 0x00010000, /// A form was set on the server. PRINTER_CHANGE_SET_FORM = 0x00020000, /// A form was deleted from the server. PRINTER_CHANGE_DELETE_FORM = 0x00040000, /// /// Notify of any changes to a form. You can set this general flag or one or more of the following specific flags: /// PRINTER_CHANGE_ADD_FORM PRINTER_CHANGE_SET_FORM PRINTER_CHANGE_DELETE_FORM /// PRINTER_CHANGE_FORM = 0x00070000, /// A port or monitor was added to the server. PRINTER_CHANGE_ADD_PORT = 0x00100000, /// A port was configured on the server. PRINTER_CHANGE_CONFIGURE_PORT = 0x00200000, /// A port or monitor was deleted from the server. PRINTER_CHANGE_DELETE_PORT = 0x00400000, /// /// Notify of any changes to a port. You can set this general flag or one or more of the following specific flags: /// PRINTER_CHANGE_ADD_PORT PRINTER_CHANGE_CONFIGURE_PORT PRINTER_CHANGE_DELETE_PORT /// PRINTER_CHANGE_PORT = 0x00700000, /// A print processor was added to the server. PRINTER_CHANGE_ADD_PRINT_PROCESSOR = 0x01000000, /// A print processor was deleted from the server. PRINTER_CHANGE_DELETE_PRINT_PROCESSOR = 0x04000000, /// /// Notify of any changes to a print processor. You can set this general flag or one or more of the following specific flags: /// PRINTER_CHANGE_ADD_PRINT_PROCESSOR PRINTER_CHANGE_DELETE_PRINT_PROCESSOR /// PRINTER_CHANGE_PRINT_PROCESSOR = 0x07000000, /// /// Windows 7: Notify of any changes to the server. This flag is not included in the changes monitored by setting the /// PRINTER_CHANGE_ALL value. /// PRINTER_CHANGE_SERVER = 0x08000000, /// A printer driver was added to the server. PRINTER_CHANGE_ADD_PRINTER_DRIVER = 0x10000000, /// A printer driver was set. PRINTER_CHANGE_SET_PRINTER_DRIVER = 0x20000000, /// A printer driver was deleted from the server. PRINTER_CHANGE_DELETE_PRINTER_DRIVER = 0x40000000, /// /// Notify of any changes to a printer driver. You can set this general flag or one or more of the following specific flags: /// PRINTER_CHANGE_ADD_PRINTER_DRIVER PRINTER_CHANGE_SET_PRINTER_DRIVER PRINTER_CHANGE_DELETE_PRINTER_DRIVER /// PRINTER_CHANGE_PRINTER_DRIVER = 0x70000000, /// The job timed out. PRINTER_CHANGE_TIMEOUT = 0x80000000, /// Notify if any of the preceding changes occur. PRINTER_CHANGE_ALL = 0x7F77FFFF, } /// Specifies the caching of a handle for a printer opened with OpenPrinter2. public enum PRINTER_CONNECTION_FLAGS { /// /// If this bit-flag is set, the printer connection is mismatched. The user can supply a local print driver as pszDriverName and /// use it to do the rendering instead of using the driver installed on the server printer to which the user is connected. /// PRINTER_CONNECTION_MISMATCH = 0x00000020, /// /// If this bit-flag is set then this call cannot display a dialog box. If a dialog box must be displayed to install a printer /// driver from the server and this bit-flag is set, the printer driver will not be installed, the printer connection will not /// be added, and the call will fail. /// /// Windows 7: In Windows 7 and later versions of Windows, if this flag is set and the user is running in elevated mode, the Do /// you trust this printer? dialog will not be shown. /// /// PRINTER_CONNECTION_NO_UI = 0x00000040, } /// The action to perform. public enum PRINTER_CONTROL { /// Pause the printer. PRINTER_CONTROL_PAUSE = 1, /// Resume a paused printer. PRINTER_CONTROL_RESUME = 2, /// Delete all print jobs in the printer. PRINTER_CONTROL_PURGE = 3, /// /// Set the printer status. Set the pPrinter parameter to a pointer to a DWORD value that specifies the new printer status. /// PRINTER_CONTROL_SET_STATUS = 4, } /// Specifies information about the returned data. [PInvokeData("winspool.h", MSDNShortId = "0b0e2d0e-2625-4cab-a8f9-536185479443")] [Flags] public enum PRINTER_ENUM { /// Returns information about a default printer. Use . PRINTER_ENUM_DEFAULT = 0x00000001, /// /// If the PRINTER_ENUM_NAME flag is not also passed, the function ignores the Name parameter, and enumerates the locally /// installed printers. If PRINTER_ENUM_NAME is also passed, the function enumerates the local printers on Name. /// PRINTER_ENUM_LOCAL = 0x00000002, /// The function enumerates the list of printers to which the user has made previous connections. PRINTER_ENUM_CONNECTIONS = 0x00000004, /// The function enumerates printers that are in the favorites list. PRINTER_ENUM_FAVORITE = 0x00000004, /// /// The function enumerates the printer identified by Name. This can be a server, a domain, or a print provider. If Name is /// NULL, the function enumerates available print providers. /// PRINTER_ENUM_NAME = 0x00000008, /// /// The function enumerates network printers and print servers in the computer's domain. This value is valid only if Level is 1. /// PRINTER_ENUM_REMOTE = 0x00000010, /// /// The function enumerates printers that have the shared attribute. Cannot be used in isolation; use an OR operation to combine /// with another PRINTER_ENUM type. /// PRINTER_ENUM_SHARED = 0x00000020, /// The function enumerates network printers in the computer's domain. This value is valid only if Level is 1. PRINTER_ENUM_NETWORK = 0x00000040, /// /// A print provider can set this flag as a hint to a calling application to enumerate this object further if default expansion /// is enabled. For example, when domains are enumerated, a print provider might indicate the user's domain by setting this flag. /// PRINTER_ENUM_EXPAND = 0x00004000, /// /// If this flag is set, the printer object may contain enumerable objects. For example, the object may be a print server that /// contains printers. /// PRINTER_ENUM_CONTAINER = 0x00008000, /// A mask value for all icon values. PRINTER_ENUM_ICONMASK = 0x00ff0000, /// /// Indicates that, where appropriate, an application should display an icon identifying the object as a top-level network name, /// such as Microsoft Windows Network. /// PRINTER_ENUM_ICON1 = 0x00010000, /// /// Indicates that, where appropriate, an application should display an icon that identifies the object as a network domain. /// PRINTER_ENUM_ICON2 = 0x00020000, /// /// Indicates that, where appropriate, an application should display an icon that identifies the object as a print server. /// PRINTER_ENUM_ICON3 = 0x00040000, /// Reserved. PRINTER_ENUM_ICON4 = 0x00080000, /// Reserved. PRINTER_ENUM_ICON5 = 0x00100000, /// Reserved. PRINTER_ENUM_ICON6 = 0x00200000, /// Reserved. PRINTER_ENUM_ICON7 = 0x00400000, /// Indicates that, where appropriate, an application should display an icon that identifies the object as a printer. PRINTER_ENUM_ICON8 = 0x00800000, /// Indicates that an application cannot display the printer object. PRINTER_ENUM_HIDE = 0x01000000, /// The function enumerates all print devices, including 3D printers. PRINTER_ENUM_CATEGORY_ALL = 0x02000000, /// The function enumerates only 3D printers. PRINTER_ENUM_CATEGORY_3D = 0x04000000, } /// The flag that determines the category of printers for which notifications will work. [PInvokeData("", MSDNShortId = "4155ef5c-cd96-4960-919b-d9a495bb73a5")] public enum PRINTER_NOTIFY_CATEGORY { /// FindNextPrinterChangeNotification returns notifications for 2D printers. PRINTER_NOTIFY_CATEGORY_2D = 0, /// FindNextPrinterChangeNotification returns notifications for both 2D and 3D printers. PRINTER_NOTIFY_CATEGORY_ALL = 0x001000, /// FindNextPrinterChangeNotification returns notifications only for 3D printers. PRINTER_NOTIFY_CATEGORY_3D = 0x002000, } /// /// Possible values for when is . /// [PInvokeData("winspool.h", MSDNShortId = "7a7b9e01-32e0-47f8-a5b1-5f7e6a663714")] public enum PRINTER_NOTIFY_FIELD : ushort { /// Not supported. PRINTER_NOTIFY_FIELD_SERVER_NAME = 0x00, /// pBuf is a pointer to a null-terminated string containing the name of the printer. PRINTER_NOTIFY_FIELD_PRINTER_NAME = 0x01, /// pBuf is a pointer to a null-terminated string that identifies the share point for the printer. PRINTER_NOTIFY_FIELD_SHARE_NAME = 0x02, /// /// pBuf is a pointer to a null-terminated string containing the name of the port that the print jobs will be printed to. If /// "Printer Pooling" is selected, this is a comma separated list of ports. /// PRINTER_NOTIFY_FIELD_PORT_NAME = 0x03, /// pBuf is a pointer to a null-terminated string containing the name of the printer's driver. PRINTER_NOTIFY_FIELD_DRIVER_NAME = 0x04, /// /// pBuf is a pointer to a null-terminated string containing the new comment string, which is typically a brief description of /// the printer. /// PRINTER_NOTIFY_FIELD_COMMENT = 0x05, /// /// pBuf is a pointer to a null-terminated string containing the new physical location of the printer (for example, "Bldg. 38, /// Room 1164"). /// PRINTER_NOTIFY_FIELD_LOCATION = 0x06, /// /// pBuf is a pointer to a DEVMODE structure that defines default printer data such as the paper orientation and the resolution. /// PRINTER_NOTIFY_FIELD_DEVMODE = 0x07, /// /// pBuf is a pointer to a null-terminated string that specifies the name of the file used to create the separator page. This /// page is used to separate print jobs sent to the printer. /// PRINTER_NOTIFY_FIELD_SEPFILE = 0x08, /// pBuf is a pointer to a null-terminated string that specifies the name of the print processor used by the printer. PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR = 0x09, /// pBuf is a pointer to a null-terminated string that specifies the default print-processor parameters. PRINTER_NOTIFY_FIELD_PARAMETERS = 0x0A, /// pBuf is a pointer to a null-terminated string that specifies the data type used to record the print job. PRINTER_NOTIFY_FIELD_DATATYPE = 0x0B, /// /// pBuf is a pointer to a SECURITY_DESCRIPTOR structure for the printer. The pointer may be NULL if there is no security descriptor. /// PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR = 0x0C, /// /// adwData [0] specifies the printer attributes, which can be one of the following values: PRINTER_ATTRIBUTE_QUEUED, /// PRINTER_ATTRIBUTE_DIRECT, PRINTER_ATTRIBUTE_DEFAULT, PRINTER_ATTRIBUTE_SHARED /// PRINTER_NOTIFY_FIELD_ATTRIBUTES = 0x0D, /// adwData [0] specifies a priority value that the spooler uses to route print jobs. PRINTER_NOTIFY_FIELD_PRIORITY = 0x0E, /// adwData [0] specifies the default priority value assigned to each print job. PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY = 0x0F, /// /// adwData [0] specifies the earliest time at which the printer will print a job. (This value is specified in minutes elapsed /// since 12:00 A.M.) /// PRINTER_NOTIFY_FIELD_START_TIME = 0x10, /// /// adwData [0] specifies the latest time at which the printer will print a job. (This value is specified in minutes elapsed /// since 12:00 A.M.) /// PRINTER_NOTIFY_FIELD_UNTIL_TIME = 0x11, /// adwData [0] specifies the printer status. For a list of possible values, see the PRINTER_INFO_2 structure. PRINTER_NOTIFY_FIELD_STATUS = 0x12, /// Not supported. PRINTER_NOTIFY_FIELD_STATUS_STRING = 0x13, /// adwData [0] specifies the number of print jobs that have been queued for the printer. PRINTER_NOTIFY_FIELD_CJOBS = 0x14, /// adwData [0] specifies the average number of pages per minute that have been printed on the printer. PRINTER_NOTIFY_FIELD_AVERAGE_PPM = 0x15, /// Not supported. PRINTER_NOTIFY_FIELD_TOTAL_PAGES = 0x16, /// Not supported. PRINTER_NOTIFY_FIELD_PAGES_PRINTED = 0x17, /// Not supported. PRINTER_NOTIFY_FIELD_TOTAL_BYTES = 0x18, /// Not supported. PRINTER_NOTIFY_FIELD_BYTES_PRINTED = 0x19, /// This is set if the object GUID changes. PRINTER_NOTIFY_FIELD_OBJECT_GUID = 0x1A, /// This is set if the printer connection is renamed. PRINTER_NOTIFY_FIELD_FRIENDLY_NAME = 0x1B, /// PRINTER_NOTIFY_FIELD_BRANCH_OFFICE_PRINTING = 0x1C, } /// Bit flags for . [PInvokeData("", MSDNShortId = "712c546d-dbb3-4f78-b14e-fbb8619b57f9")] [Flags] public enum PRINTER_NOTIFY_OPTIONS_FLAG { /// Provides current data for all monitored printer information fields. PRINTER_NOTIFY_OPTIONS_REFRESH = 1 } /// Specifies the caching of a handle for a printer opened with OpenPrinter2. // https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-option-flags typedef enum tagPRINTER_OPTION_FLAGS { // PRINTER_OPTION_NO_CACHE, PRINTER_OPTION_CACHE, PRINTER_OPTION_CLIENT_CHANGE } PRINTER_OPTION_FLAGS; [PInvokeData("Winspool.h", MSDNShortId = "e5a62322-723c-490d-8de1-f74dcac9e22d")] [Flags] public enum PRINTER_OPTION_FLAGS { /// The handle is not cached. All functions applied to a handle returned by OpenPrinter2 will go to the remote computer. PRINTER_OPTION_NO_CACHE = 1, /// The handle is cached. All functions applied to a handle returned by OpenPrinter2 will go to the local cache. PRINTER_OPTION_CACHE = 2, /// The handle returned by OpenPrinter2 can be used by SetPrinter to rename the printer connection. PRINTER_OPTION_CLIENT_CHANGE = 4, /// PRINTER_OPTION_NO_CLIENT_DATA = 8, } /// The printer status. [PInvokeData("winspool.h", MSDNShortId = "944cbfcd-9edf-4b60-a45c-9bb1839f8141")] public enum PRINTER_STATUS { /// The printer is busy. PRINTER_STATUS_BUSY = 0x00000200, /// The printer door is open. PRINTER_STATUS_DOOR_OPEN = 0x00400000, /// The printer is in an error state. PRINTER_STATUS_ERROR = 0x00000002, /// The printer is initializing. PRINTER_STATUS_INITIALIZING = 0x00008000, /// The printer is in an active input or output state. PRINTER_STATUS_IO_ACTIVE = 0x00000100, /// The printer is in a manual feed state. PRINTER_STATUS_MANUAL_FEED = 0x00000020, /// The printer is not available for printing. PRINTER_STATUS_NOT_AVAILABLE = 0x00001000, /// The printer is out of toner. PRINTER_STATUS_NO_TONER = 0x00040000, /// The printer is offline. PRINTER_STATUS_OFFLINE = 0x00000080, /// The printer's output bin is full. PRINTER_STATUS_OUTPUT_BIN_FULL = 0x00000800, /// The printer has run out of memory. PRINTER_STATUS_OUT_OF_MEMORY = 0x00200000, /// The printer cannot print the current page. PRINTER_STATUS_PAGE_PUNT = 0x00080000, /// Paper is stuck in the printer. PRINTER_STATUS_PAPER_JAM = 0x00000008, /// The printer is out of paper. PRINTER_STATUS_PAPER_OUT = 0x00000010, /// The printer has an unspecified paper problem. PRINTER_STATUS_PAPER_PROBLEM = 0x00000040, /// The printer is paused. PRINTER_STATUS_PAUSED = 0x00000001, /// /// The printer is being deleted as a result of a client's call to RpcDeletePrinter. No new jobs can be submitted on existing /// printer objects for that printer. /// PRINTER_STATUS_PENDING_DELETION = 0x00000004, /// The printer is in power-save mode. PRINTER_STATUS_POWER_SAVE = 0x01000000, /// The printer is printing. PRINTER_STATUS_PRINTING = 0x00000400, /// The printer is processing a print job. PRINTER_STATUS_PROCESSING = 0x00004000, /// The printer is offline. PRINTER_STATUS_SERVER_OFFLINE = 0x02000000, /// The printer status is unknown. PRINTER_STATUS_SERVER_UNKNOWN = 0x00800000, /// The printer is low on toner. PRINTER_STATUS_TONER_LOW = 0x00020000, /// The printer has an error that requires the user to do something. PRINTER_STATUS_USER_INTERVENTION = 0x00100000, /// The printer is waiting. PRINTER_STATUS_WAITING = 0x00002000, /// The printer is warming up. PRINTER_STATUS_WARMING_UP = 0x00010000, /// The printer driver needs an update. PRINTER_STATUS_DRIVER_UPDATE_NEEDED = 0x04000000, } /// Attribute flags for printer drivers. [PInvokeData("winspool.h", MSDNShortId = "6237def2-ffd4-4d93-b3a4-56f225793457")] [Flags] public enum PrinterDriverAttributes { /// The printer driver is part of a driver package. Windows Vista PRINTER_DRIVER_PACKAGE_AWARE = 0x00000001, /// The printer driver supports the Microsoft XPS format described in the XML Paper Specification: Overview, and also /// in Product Behavior, section 27. Windows 8, Windows Server 2012 PRINTER_DRIVER_XPS = 0x00000002, /// The printer driver is compatible with printer driver isolation. For more information, see Product Behavior, section /// 28. Windows 7, Windows Server 2008 R2 PRINTER_DRIVER_SANDBOX_ENABLED = 0x00000004, /// The printer driver is a class printer driver. Windows 8, Windows Server 2012 PRINTER_DRIVER_CLASS = 0x00000008, /// The printer driver is a derived printer driver. Windows 8, Windows Server 2012 PRINTER_DRIVER_DERIVED = 0x00000010, /// Printers using this printer driver cannot be shared. Windows 8, Windows Server 2012 PRINTER_DRIVER_NOT_SHAREABLE = 0x00000020, /// The printer driver is intended for use with fax printers. Windows 8, Windows Server 2012 PRINTER_DRIVER_CATEGORY_FAX = 0x00000040, /// The printer driver is intended for use with file printers. Windows 8, Windows Server 2012 PRINTER_DRIVER_CATEGORY_FILE = 0x00000080, /// The printer driver is intended for use with virtual printers. Windows 8, Windows Server 2012 PRINTER_DRIVER_CATEGORY_VIRTUAL = 0x00000100, /// The printer driver is intended for use with service printers. Windows 8, Windows Server 2012 PRINTER_DRIVER_CATEGORY_SERVICE = 0x00000200, /// Printers that use this printer driver should follow the guidelines outlined in the USB Device Class Definition. For /// more information, see Product Behavior, section 36 Windows 8, Windows Server 2012 PRINTER_DRIVER_SOFT_RESET_REQUIRED = 0x00000400, } } }