DWORD DrvDeviceCapabilities(
HANDLE hPrinter, | |
PWSTR pDeviceName, | |
WORD iDevCap, | |
VOID *pvOutput, | |
PDEVMODE pDevMode | |
); |
DrvDeviceCapabilities provides information about the specified device and its capabilities.
Parameters
hPrinter
Handle to the printer whose capabilities are being queried.
pDeviceName
Points to a null-terminated string that specifies the name of the printing device.
iDevCap
Specifies the device capability about which information is requested. This parameter can be one of the following values, as defined in windef.h:
Flag | Description |
DC_FIELDS | Returns the dmFields member of the printer driver’s DEVMODE structure, indicating which members in the device-independent portion of the structure are supported by the printer driver. |
DC_PAPERS | Writes a list of indexes in the WORD array to which pvOutput points, where each index represents a supported form. The return value is set to the number of supported forms. |
DC_PAPERSIZE | Writes a list of supported paper sizes, in 0.1mm increments, in the array of POINT structures to which pvOutput points. The return value is set to the number of supported paper sizes. |
DC_PAPERNAMES | Writes a list of supported form names in the Unicode string array to which pvOutput points. The pvOutput parameter points to an array of string buffers that are each 64 characters in length. If a form name is less than 64 characters in length, the driver pads that buffer with null characters; if a form name is equal to 64 characters in length, the driver does not append a null character. Form names that are greater than 64 characters in length are truncated and no null character is appended. Return value is set to the number of supported form names. |
DC_MINEXTENT | Writes the minimum allowable values for the dmPaperLength and dmPaperWidth members of the driver’s DEVMODE structure. The function returns these values in a POINTS structure. The low and high words of the returned value specify x and y, respectively. |
DC_MAXEXTENT | Writes the maximum allowable values for the dmPaperLength and dmPaperWidth members of the printer driver’s DEVMODE structure. The function returns these values in a POINTS structure. The low and high words of the returned value specify x and y, respectively. |
DC_BINS | Writes a list of indexes in a WORD array to which pvOutput points, where each index represents an available paper bin. Returns the number of input bins. |
DC_BINNAMES | Writes a list of the names of the input bins in pvOutput. The pvOutput parameter points to an array of string buffers that are each 24 characters in length. The driver should add a terminating null character to each string. Bin names that are greater than 24 characters in length are truncated and a null character is appended. Returns the number of input bins. |
DC_DUPLEX | Returns 1 if the printer supports duplex printing; otherwise, zero is returned. |
DC_SIZE | Returns the dmSize member of the printer driver’s DEVMODE structure. |
DC_EXTRA | Returns the dmDriverExtra member of the driver’s DEVMODE structure. |
DC_VERSION | Returns the dmSpecVersion member of the driver’s DEVMODE structure. |
DC_DRIVER | Returns the dmDriverVersion member of driver’s DEVMODE structure. |
DC_ENUMRESOLUTIONS | Writes the list of printer-supported resolutions in pvOutput. Each resolution is specified as a pair of LONG integers that represent the horizontal and vertical resolutions. The return value is the number of printer-supported resolutions. |
DC_FILEDEPENDENCIES | Writes the names of all files that need to be loaded when the driver is installed in pvOutput. The pvOutput parameter points to an array of string buffers that are each 64 characters in length. Each filename is a null-terminated string. The return value is the number of files. |
DC_TRUETYPE | Returns a bitwise OR of one or more of the following values, indicating the ability of the driver to use TrueType fonts (a value of zero indicates no support): 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_ORIENTATION | Returns the relationship between portrait and landscape orientations for a device. The return value is in terms of the number of degrees that portrait orientation is rotated counterclockwise to produce landscape orientation. Zero means that landscape orientation is not available. |
DC_COPIES | Returns the maximum number of copies of a document that the printer can print. |
pvOutput
Pointer to the output buffer in which device capability data can be returned. The size and type of returned device capability data, if any, depends on the value specified in iDevCap.
pDevMode
Pointer to the source DEVMODE structure.
Return Value
DrvDeviceCapabilities returns the specified device’s capabilities upon success. The actual value depends on iDevCap. The driver should turn off the iDevCap bit for any feature it does not support and return a single value for that value. For example, if the device does not support multiple resolutions, the drivers returns only one resolution when queried with an iDevCap value of DC_ENUMRESOLUTIONS.
This function returns GDI_ERROR if it fails.
Comments
If pvOutput is null for an iDevCap value that requires a buffer, the driver should set the return value accordingly so that the caller can allocate the correct size of buffer and call DrvDeviceCapabilities again.