DeviceCapabilitiesW function (wingdi.h)
The DeviceCapabilities function retrieves the capabilities of a printer driver.
int DeviceCapabilitiesW(
[in] LPCWSTR pDevice,
[in] LPCWSTR pPort,
[in] WORD fwCapability,
[out] LPWSTR pOutput,
[in] const DEVMODEW *pDevMode
);
[in] pDevice
A pointer to a null-terminated string that contains the name of the printer. Note that this is the name of the printer, not of the printer driver.
[in] pPort
A pointer to a null-terminated string that contains the name of the port to which the device is connected, such as LPT1.
[in] fwCapability
The capabilities to be queried. This parameter can be one of the following values.
Value | Meaning |
---|---|
|
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. |
|
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. |
|
If the printer supports collating, the return value is 1; otherwise, the return value is zero. The pOutput parameter is not used. |
|
If the printer supports color printing, the return value is 1; otherwise, the return value is zero. The pOutput parameter is not used. |
|
Returns the number of copies the device can print. |
|
Returns the version number of the printer driver. |
|
If the printer supports duplex printing, the return value is 1; otherwise, the return value is zero. The pOutput parameter is not used. |
|
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. |
|
Returns the number of bytes required for the device-specific portion of the DEVMODE structure for the printer driver. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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:
|
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
The return value is the amount of available printer memory, in kilobytes. The pOutput parameter is not used. |
|
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. |
|
The return value indicates the printer's print rate, in pages per minute. The pOutput parameter is not used. |
|
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.
|
|
Returns the dmSize member of the printer driver's DEVMODE structure. |
|
If the printer supports stapling, the return value is a nonzero value; otherwise, the return value is zero. The pOutput parameter is not used. |
|
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:
|
|
Returns the specification version to which the printer driver conforms. |
[out] pOutput
A pointer to an array. The format of the array depends on the setting of the fwCapability parameter. See each capability above to find out what is returned if pOutput is NULL.
[in] pDevMode
A pointer to a DEVMODE structure. If this parameter is NULL, DeviceCapabilities retrieves the current default initialization values for the specified printer driver. Otherwise, the function retrieves the values contained in the structure to which pDevMode points.
If the function succeeds, the return value depends on the setting of the fwCapability parameter. A return value of zero generally indicates that, while the function completed successfully, there was some type of failure, such as a capability that is not supported. For more details, see the descriptions for the fwCapability values.
If the function returns -1, this may mean either that the capability is not supported or there was a general function failure.
If a printer driver supports custom device capabilities, the driver must call the SetPrinterData function for each custom capability. The SetPrinterData function adds the appropriate printer data to the print system, which enables 32-bit applications to access the custom capabilities on 64-bit Windows installations.
For each custom capability, you must first add printer data that describes the type of the capability. To do this, when you call SetPrinterData, set the pValueName string to CustomDeviceCapabilityType_Xxx, where "Xxx" is the hexadecimal representation of the capability. For example, you might have "CustomDeviceCapabilityType_1234". The registry data that you set must be of the REG_DWORD type, and you must set its value to one of the following:
- 0, if the custom capability is a DWORD
- 1, if the custom capability is a buffer of bytes
- 2, if the custom capability is an array of items
Note
The wingdi.h header defines DeviceCapabilities as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | wingdi.h (include Windows.h) |
Library | WinSpool.lib |
DLL | WinSpool.drv |