Winspool (JNA API)

com.sun.jna.platform.win32

## Interface Winspool

- All Superinterfaces:
    AltCallingConvention, Library, StdCall, StdCallLibrary

      public interface Winspool
      extends StdCallLibrary

  Ported from Winspool.h. Windows SDK 6.0a
  Author:
    dblock[at]dblock.org

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `Winspool.JOB_INFO_1`
    `static class` | `Winspool.LPPRINTER_DEFAULTS`
    `static class` | `Winspool.PRINTER_INFO_1`
    `static class` | `Winspool.PRINTER_INFO_4`

    - ### Nested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibrary

      `StdCallLibrary.StdCallCallback`

    - ### Nested classes/interfaces inherited from interface com.sun.jna.Library

      `Library.Handler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CCHDEVICENAME`
    `static Winspool` | `INSTANCE`
    `static int` | `PRINTER_CHANGE_ADD_FORM`
    `static int` | `PRINTER_CHANGE_ADD_JOB`
    `static int` | `PRINTER_CHANGE_ADD_PORT`
    `static int` | `PRINTER_CHANGE_ADD_PRINT_PROCESSOR`
    `static int` | `PRINTER_CHANGE_ADD_PRINTER`
    `static int` | `PRINTER_CHANGE_ADD_PRINTER_DRIVER`
    `static int` | `PRINTER_CHANGE_ALL`
    `static int` | `PRINTER_CHANGE_ALL_WIN7`
    `static int` | `PRINTER_CHANGE_CONFIGURE_PORT`
    `static int` | `PRINTER_CHANGE_DELETE_FORM`
    `static int` | `PRINTER_CHANGE_DELETE_JOB`
    `static int` | `PRINTER_CHANGE_DELETE_PORT`
    `static int` | `PRINTER_CHANGE_DELETE_PRINT_PROCESSOR`
    `static int` | `PRINTER_CHANGE_DELETE_PRINTER`
    `static int` | `PRINTER_CHANGE_DELETE_PRINTER_DRIVER`
    `static int` | `PRINTER_CHANGE_FAILED_CONNECTION_PRINTER`
    `static int` | `PRINTER_CHANGE_FORM`
    `static int` | `PRINTER_CHANGE_JOB`
    `static int` | `PRINTER_CHANGE_PORT`
    `static int` | `PRINTER_CHANGE_PRINT_PROCESSOR`
    `static int` | `PRINTER_CHANGE_PRINTER`
    `static int` | `PRINTER_CHANGE_PRINTER_DRIVER`
    `static int` | `PRINTER_CHANGE_SERVER`
    `static int` | `PRINTER_CHANGE_SET_FORM`
    `static int` | `PRINTER_CHANGE_SET_JOB`
    `static int` | `PRINTER_CHANGE_SET_PRINTER`
    `static int` | `PRINTER_CHANGE_SET_PRINTER_DRIVER`
    `static int` | `PRINTER_CHANGE_TIMEOUT`
    `static int` | `PRINTER_CHANGE_WRITE_JOB`
    `static int` | `PRINTER_ENUM_CONNECTIONS`
    `static int` | `PRINTER_ENUM_CONTAINER`
    `static int` | `PRINTER_ENUM_DEFAULT`
    `static int` | `PRINTER_ENUM_EXPAND`
    `static int` | `PRINTER_ENUM_FAVORITE`
    `static int` | `PRINTER_ENUM_HIDE`
    `static int` | `PRINTER_ENUM_ICON1`
    `static int` | `PRINTER_ENUM_ICON2`
    `static int` | `PRINTER_ENUM_ICON3`
    `static int` | `PRINTER_ENUM_ICON4`
    `static int` | `PRINTER_ENUM_ICON5`
    `static int` | `PRINTER_ENUM_ICON6`
    `static int` | `PRINTER_ENUM_ICON7`
    `static int` | `PRINTER_ENUM_ICON8`
    `static int` | `PRINTER_ENUM_ICONMASK`
    `static int` | `PRINTER_ENUM_LOCAL`
    `static int` | `PRINTER_ENUM_NAME`
    `static int` | `PRINTER_ENUM_NETWORK`
    `static int` | `PRINTER_ENUM_REMOTE`
    `static int` | `PRINTER_ENUM_SHARED`

    - ### Fields inherited from interface com.sun.jna.win32.StdCallLibrary

      `FUNCTION_MAPPER, STDCALL_CONVENTION`

    - ### Fields inherited from interface com.sun.jna.Library

      `OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `EnumJobs(WinNT.HANDLE hPrinter, int FirstJob, int NoJobs, int Level, Pointer pJob, int cbBuf, IntByReference pcbNeeded, IntByReference pcReturned)`
    `boolean` | `EnumPrinters(int Flags, java.lang.String Name, int Level, Pointer pPrinterEnum, int cbBuf, IntByReference pcbNeeded, IntByReference pcReturned)` The EnumPrinters function enumerates available printers, print servers, domains, or print providers.
    `boolean` | `FindClosePrinterChangeNotification(WinNT.HANDLE hChange)` The FindClosePrinterChangeNotification function closes a change notification object created by calling the FindFirstPrinterChangeNotification function.
    `WinNT.HANDLE` | `FindFirstPrinterChangeNotification(WinNT.HANDLE hPrinter, int fdwFilter, int fdwOptions, WinDef.LPVOID pPrinterNotifyOptions)` The FindFirstPrinterChangeNotification function creates a change notification object and returns a handle to the object.
    `boolean` | `FindNextPrinterChangeNotification(WinNT.HANDLE hChange, WinDef.DWORDByReference pdwChange, WinDef.LPVOID pPrinterNotifyOptions, WinDef.LPVOID ppPrinterNotifyInfo)` The FindNextPrinterChangeNotification function retrieves information about the most recent change notification for a change notification object associated with a printer or print server.
    `boolean` | `OpenPrinter(java.lang.String pPrinterName, WinNT.HANDLEByReference phPrinter, Winspool.LPPRINTER_DEFAULTS pDefault)` The OpenPrinter function retrieves a handle to the specified printer or print server or other types of handles in the print subsystem.

- - ### Field Detail

    - #### CCHDEVICENAME

          static final int CCHDEVICENAME

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_ADD_PRINTER

          static final int PRINTER_CHANGE_ADD_PRINTER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_SET_PRINTER

          static final int PRINTER_CHANGE_SET_PRINTER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_DELETE_PRINTER

          static final int PRINTER_CHANGE_DELETE_PRINTER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_FAILED_CONNECTION_PRINTER

          static final int PRINTER_CHANGE_FAILED_CONNECTION_PRINTER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_PRINTER

          static final int PRINTER_CHANGE_PRINTER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_ADD_JOB

          static final int PRINTER_CHANGE_ADD_JOB

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_SET_JOB

          static final int PRINTER_CHANGE_SET_JOB

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_DELETE_JOB

          static final int PRINTER_CHANGE_DELETE_JOB

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_WRITE_JOB

          static final int PRINTER_CHANGE_WRITE_JOB

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_JOB

          static final int PRINTER_CHANGE_JOB

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_ADD_FORM

          static final int PRINTER_CHANGE_ADD_FORM

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_SET_FORM

          static final int PRINTER_CHANGE_SET_FORM

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_DELETE_FORM

          static final int PRINTER_CHANGE_DELETE_FORM

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_FORM

          static final int PRINTER_CHANGE_FORM

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_ADD_PORT

          static final int PRINTER_CHANGE_ADD_PORT

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_CONFIGURE_PORT

          static final int PRINTER_CHANGE_CONFIGURE_PORT

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_DELETE_PORT

          static final int PRINTER_CHANGE_DELETE_PORT

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_PORT

          static final int PRINTER_CHANGE_PORT

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_ADD_PRINT_PROCESSOR

          static final int PRINTER_CHANGE_ADD_PRINT_PROCESSOR

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_DELETE_PRINT_PROCESSOR

          static final int PRINTER_CHANGE_DELETE_PRINT_PROCESSOR

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_PRINT_PROCESSOR

          static final int PRINTER_CHANGE_PRINT_PROCESSOR

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_SERVER

          static final int PRINTER_CHANGE_SERVER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_ADD_PRINTER_DRIVER

          static final int PRINTER_CHANGE_ADD_PRINTER_DRIVER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_SET_PRINTER_DRIVER

          static final int PRINTER_CHANGE_SET_PRINTER_DRIVER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_DELETE_PRINTER_DRIVER

          static final int PRINTER_CHANGE_DELETE_PRINTER_DRIVER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_PRINTER_DRIVER

          static final int PRINTER_CHANGE_PRINTER_DRIVER

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_TIMEOUT

          static final int PRINTER_CHANGE_TIMEOUT

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_ALL_WIN7

          static final int PRINTER_CHANGE_ALL_WIN7

      See Also:
        Constant Field Values

    - #### PRINTER_CHANGE_ALL

          static final int PRINTER_CHANGE_ALL

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_DEFAULT

          static final int PRINTER_ENUM_DEFAULT

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_LOCAL

          static final int PRINTER_ENUM_LOCAL

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_CONNECTIONS

          static final int PRINTER_ENUM_CONNECTIONS

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_FAVORITE

          static final int PRINTER_ENUM_FAVORITE

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_NAME

          static final int PRINTER_ENUM_NAME

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_REMOTE

          static final int PRINTER_ENUM_REMOTE

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_SHARED

          static final int PRINTER_ENUM_SHARED

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_NETWORK

          static final int PRINTER_ENUM_NETWORK

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_EXPAND

          static final int PRINTER_ENUM_EXPAND

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_CONTAINER

          static final int PRINTER_ENUM_CONTAINER

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICONMASK

          static final int PRINTER_ENUM_ICONMASK

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICON1

          static final int PRINTER_ENUM_ICON1

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICON2

          static final int PRINTER_ENUM_ICON2

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICON3

          static final int PRINTER_ENUM_ICON3

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICON4

          static final int PRINTER_ENUM_ICON4

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICON5

          static final int PRINTER_ENUM_ICON5

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICON6

          static final int PRINTER_ENUM_ICON6

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICON7

          static final int PRINTER_ENUM_ICON7

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_ICON8

          static final int PRINTER_ENUM_ICON8

      See Also:
        Constant Field Values

    - #### PRINTER_ENUM_HIDE

          static final int PRINTER_ENUM_HIDE

      See Also:
        Constant Field Values

    - #### INSTANCE

          static final Winspool INSTANCE

  - ### Method Detail

    - #### EnumPrinters

          boolean EnumPrinters(int Flags,
                             java.lang.String Name,
                             int Level,
                             Pointer pPrinterEnum,
                             int cbBuf,
                             IntByReference pcbNeeded,
                             IntByReference pcReturned)

      The EnumPrinters function enumerates available printers, print servers, domains, or print providers.
      Parameters:
        `Flags` - The types of print objects that the function should enumerate.
        `Name` - If Level is 1, Flags contains PRINTER_ENUM_NAME, and Name is non-NULL, then Name is a pointer to a null-terminated string that specifies the name of the object to enumerate. This string can be the name of a server, a domain, or a print provider. If Level is 1, Flags contains PRINTER_ENUM_NAME, and Name is NULL, then the function enumerates the available print providers. If Level is 1, Flags contains PRINTER_ENUM_REMOTE, and Name is NULL, then the function enumerates the printers in the user's domain. If Level is 2 or 5,Name is a pointer to a null-terminated string that specifies the name of a server whose printers are to be enumerated. If this string is NULL, then the function enumerates the printers installed on the local computer. If Level is 4, Name should be NULL. The function always queries on the local computer. When Name is NULL, setting Flags to PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS enumerates printers that are installed on the local machine. These printers include those that are physically attached to the local machine as well as remote printers to which it has a network connection. When Name is not NULL, setting Flags to PRINTER_ENUM_LOCAL | PRINTER_ENUM_NAME enumerates the local printers that are installed on the server Name.
        `Level` - The type of data structures pointed to by pPrinterEnum. Valid values are 1, 2, 4, and 5, which correspond to the PRINTER_INFO_1, PRINTER_INFO_2 , PRINTER_INFO_4, and PRINTER_INFO_5 data structures.
        `pPrinterEnum` - A pointer to a buffer that receives an array of PRINTER_INFO_1, PRINTER_INFO_2, PRINTER_INFO_4, or PRINTER_INFO_5 structures. Each structure contains data that describes an available print object. If Level is 1, the array contains PRINTER_INFO_1 structures. If Level is 2, the array contains PRINTER_INFO_2 structures. If Level is 4, the array contains PRINTER_INFO_4 structures. If Level is 5, the array contains PRINTER_INFO_5 structures. The buffer must be large enough to receive the array of data structures and any strings or other data to which the structure members point. If the buffer is too small, the pcbNeeded parameter returns the required buffer size.
        `cbBuf` - The size, in bytes, of the buffer pointed to by pPrinterEnum.
        `pcbNeeded` - A pointer to a value that receives the number of bytes copied if the function succeeds or the number of bytes required if cbBuf is too small.
        `pcReturned` - A pointer to a value that receives the number of PRINTER_INFO_1, PRINTER_INFO_2 , PRINTER_INFO_4, or PRINTER_INFO_5 structures that the function returns in the array to which pPrinterEnum points.
      Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero.

    - #### OpenPrinter

          boolean OpenPrinter(java.lang.String pPrinterName,
                            WinNT.HANDLEByReference phPrinter,
                            Winspool.LPPRINTER_DEFAULTS pDefault)

      The OpenPrinter function retrieves a handle to the specified printer or print server or other types of handles in the print subsystem.
      Parameters:
        `pPrinterName` - [in] A pointer to a null-terminated string that specifies the name of the printer or print server, the printer object, the XcvMonitor, or the XcvPort. For a printer object use: PrinterName, Job xxxx. For an XcvMonitor, use: ServerName, XcvMonitor MonitorName. For an XcvPort, use: ServerName, XcvPort PortName. If NULL, it indicates the local printer server.
        `phPrinter` - [out] A pointer to a variable that receives a handle (not thread safe) to the open printer or print server object. The phPrinter parameter can return an Xcv handle for use with the XcvData function. For more information about XcvData, see the DDK.
        `pDefault` - [in] A pointer to a PRINTER_DEFAULTS structure. This value can be NULL.
      Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero.
      See Also:
        MSDN

    - #### FindFirstPrinterChangeNotification

          WinNT.HANDLE FindFirstPrinterChangeNotification(WinNT.HANDLE hPrinter,
                                                        int fdwFilter,
                                                        int fdwOptions,
                                                        WinDef.LPVOID pPrinterNotifyOptions)

      The FindFirstPrinterChangeNotification function creates a change notification object and returns a handle to the object. You can then use this handle in a call to one of the wait functions to monitor changes to the printer or print server. The FindFirstPrinterChangeNotification call specifies the type of changes to be monitored. You can specify a set of conditions to monitor for changes, a set of printer information fields to monitor, or both. A wait operation on the change notification handle succeeds when one of the specified changes occurs in the specified printer or print server. You then call the FindNextPrinterChangeNotification function to retrieve information about the change, and to reset the change notification object for use in the next wait operation.
      Parameters:
        `hPrinter` - [in] A handle to the printer or print server that you want to monitor. Use the OpenPrinter or AddPrinter function to retrieve a printer handle.
        `fdwFilter` - 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. The fdwFilter parameter can be zero if pPrinterNotifyOptions is non-NULL.
        `fdwOptions` - Reserved; must be zero.
        `pPrinterNotifyOptions` - [in, optional] A pointer to a PRINTER_NOTIFY_OPTIONS structure. The pTypes member of this structure is an array of one or more PRINTER_NOTIFY_OPTIONS_TYPE structures, each of which specifies a printer information field to monitor. A change notification occurs when one or more of the specified fields changes. When a change occurs, the FindNextPrinterChangeNotification function can retrieve the new printer information. This parameter can be NULL if fdwFilter is nonzero. For a list of fields that can be monitored, see PRINTER_NOTIFY_OPTIONS_TYPE.
      Returns:
        If the function succeeds, the return value is a handle to a change notification object associated with the specified printer or print server. If the function fails, the return value is INVALID_HANDLE_VALUE.
      See Also:
        MSDN

    - #### FindNextPrinterChangeNotification

          boolean FindNextPrinterChangeNotification(WinNT.HANDLE hChange,
                                                  WinDef.DWORDByReference pdwChange,
                                                  WinDef.LPVOID pPrinterNotifyOptions,
                                                  WinDef.LPVOID ppPrinterNotifyInfo)

      The FindNextPrinterChangeNotification function retrieves information about the most recent change notification for a change notification object associated with a printer or print server. Call this function when a wait operation on the change notification object is satisfied. The function also resets the change notification object to the not-signaled state. You can then use the object in another wait operation to continue monitoring the printer or print server. The operating system will set the object to the signaled state the next time one of a specified set of changes occurs to the printer or print server. The FindFirstPrinterChangeNotification function creates the change notification object and specifies the set of changes to be monitored.
      Parameters:
        `hChange` - [in] A handle to a change notification object associated with a printer or print server. You obtain such a handle by calling the FindFirstPrinterChangeNotification function. The operating system sets this change notification object to the signaled state when it detects one of the changes specified in the object's change notification filter.
        `pdwChange` - [out, optional] A pointer to a variable whose bits are set to indicate the changes that occurred to cause the most recent notification. The bit flags that might be set correspond to those specified in the fdwFilter parameter of the FindFirstPrinterChangeNotification call. The system sets one or more of the following bit flags.
        `pPrinterNotifyOptions` - [in, optional] A pointer to a PRINTER_NOTIFY_OPTIONS structure. Set the Flags member of this structure to PRINTER_NOTIFY_OPTIONS_REFRESH, to cause the function to return the current data for all monitored printer information fields. The function ignores all other members of the structure. This parameter can be NULL.
        `ppPrinterNotifyInfo` - [out, optional] A pointer to a pointer variable that receives a pointer to a system-allocated, read-only buffer. Call the FreePrinterNotifyInfo function to free the buffer when you are finished with it. This parameter can be NULL if no information is required. The buffer contains a PRINTER_NOTIFY_INFO structure, which contains an array of PRINTER_NOTIFY_INFO_DATA structures. Each element of the array contains information about one of the fields specified in the pPrinterNotifyOptions parameter of the FindFirstPrinterChangeNotification call. Typically, the function provides data only for the fields that changed to cause the most recent notification. However, if the structure pointed to by the pPrinterNotifyOptions parameter specifies PRINTER_NOTIFY_OPTIONS_REFRESH, the function provides data for all monitored fields. If the PRINTER_NOTIFY_INFO_DISCARDED bit is set in the Flags member of the PRINTER_NOTIFY_INFO structure, an overflow or error occurred, and notifications may have been lost. In this case, no additional notifications will be sent until you make a second FindNextPrinterChangeNotification call that specifies PRINTER_NOTIFY_OPTIONS_REFRESH.
      Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero.
      See Also:
        MSDN

    - #### FindClosePrinterChangeNotification

          boolean FindClosePrinterChangeNotification(WinNT.HANDLE hChange)

      The FindClosePrinterChangeNotification function closes a change notification object created by calling the FindFirstPrinterChangeNotification function. The printer or print server associated with the change notification object will no longer be monitored by that object.
      Parameters:
        `hChange` - [in] A handle to the change notification object to be closed. This is a handle created by calling the FindFirstPrinterChangeNotification function.
      Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero.
      See Also:
        MSDN

    - #### EnumJobs

          boolean EnumJobs(WinNT.HANDLE hPrinter,
                         int FirstJob,
                         int NoJobs,
                         int Level,
                         Pointer pJob,
                         int cbBuf,
                         IntByReference pcbNeeded,
                         IntByReference pcReturned)

Copyright © 2007-2016 Timothy Wall. All Rights Reserved.