Click to Rate and Give Feedback
MSDN
MSDN Library
Windows GDI
 DeviceCapabilities
Windows GDI
DeviceCapabilities

The DeviceCapabilities function retrieves the capabilities of a printer device driver.

DWORD DeviceCapabilities(
  LPCTSTR pDevice,         // printer name
  LPCTSTR pPort,           // port name
  WORD fwCapability,       // device capability
  LPTSTR pOutput,          // output buffer
  CONST DEVMODE *pDevMode  // device data buffer
);

Parameters

pDevice
[in] 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.
pPort
[in] Pointer to a null-terminated string that contains the name of the port to which the device is connected, such as LPT1.
fwCapability
[in] Specifies the capabilities to query. This parameter can be one of the following values.
Value Meaning
DC_BINADJUST Windows 95/98/Me: Retrieves the page positioning for the paper source specified in the DEVMODE structure pointed to by pdevMode. The return value can be one of the following:

DCBA_FACEUPNONE
DCBA_FACEUPCENTER
DCBA_FACEUPLEFT
DCBA_FACEUPRIGHT
DCBA_FACEDOWNNONE
DCBA_FACEDOWNCENTER
DCBA_FACEDOWNLEFT
DCBA_FACEDOWNRIGHT

Windows NT/2000/XP: Not supported.

DC_BINNAMES 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_BINS 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_COLLATE If the printer supports collating, the return value is 1; otherwise, the return value is zero. The pOutput parameter is not used.
DC_COLORDEVICE Windows 2000/XP: If the printer supports color printing, the return value is 1; otherwise, the return value is zero. The pOutput parameter is not used.
DC_COPIES Returns the number of copies the device can print.
DC_DRIVER Returns the version number of the printer driver.
DC_DATATYPE_PRODUCED Windows 95/98/Me: The return value is the number of data types supported by the printer driver. If the function returns -1, the driver recognizes only the "RAW" data type. The names of the supported data types are copied to an array. Use the names in the DOCINFO structure when calling the StartDoc function to specify the data type.

Windows NT/2000/XP: Not supported.

DC_DUPLEX If the printer supports duplex printing, the return value is 1; otherwise, the return value is zero. The pOutput parameter is not used.
DC_EMF_COMPLIANT Windows 95/98/Me: Determines if a printer driver supports enhanced metafiles (EMF). A return value of 1 means the driver supports EMF. A return value of -1 means the driver does not support EMF.

Windows NT/2000/XP: Not supported.

DC_ENUMRESOLUTIONS 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_EXTRA Returns the number of bytes required for the device-specific portion of the DEVMODE structure for the printer driver.
DC_FIELDS 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_FILEDEPENDENCIES 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_MANUFACTURER Windows 95/98/Me: The return value is the identification number of the printer manufacturer. This value is used with Image Color Management (ICM).

Windows NT/2000/XP: Not supported.

DC_MAXEXTENT 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_MEDIAREADY Windows 2000/XP: 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_MEDIATYPENAMES Windows XP: 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_MEDIATYPES Windows XP: 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_MINEXTENT 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_MODEL Windows 95/98/Me: The return value is the identification of the printer model. This value is used with Image Color Management (ICM).

Windows NT/2000/XP: Not supported.

DC_ORIENTATION 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_NUP Windows 2000/XP: 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_PAPERNAMES 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_PAPERS 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_PAPERSIZE 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_PERSONALITY Windows 2000/XP: 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_PRINTERMEM Windows 2000/XP: The return value is the amount of available printer memory, in kilobytes. The pOutput parameter is not used.
DC_PRINTRATE Windows 2000/XP: 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_PRINTRATEPPM Windows 2000/XP: The return value indicates the printer's print rate, in pages per minute. The pOutput parameter is not used.
DC_PRINTRATEUNIT Windows 2000/XP: 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_SIZE Returns the dmSize member of the printer driver's DEVMODE structure.
DC_STAPLE Windows 2000/XP: 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_TRUETYPE 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 down-load TrueType fonts.
DCTT_DOWNLOAD_OUTLINE
Windows 95/98/Me: Device can download outline TrueType fonts.
DCTT_SUBDEV
Device can substitute device fonts for TrueType fonts.
DC_VERSION Returns the specification version to which the printer driver conforms.

pOutput
[out] Pointer to an array. The format of the array depends on the setting of the fwCapability parameter. If pOutput is NULL, DeviceCapabilities returns the number of bytes required for the output data.
pDevMode
[in] 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.

Return Values

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.

Windows NT/2000/XP: To get extended error information, call GetLastError.

Remarks

The DEVMODE structure pointed to by the pDevMode parameter may be obtained by calling the DocumentProperties function.

Requirements

  Windows NT/2000/XP/Vista: Included in Windows NT 3.1 and later.
  Windows 95/98/Me: Included in Windows 95 and later.
  Header: Declared in Wingdi.h; include Windows.h.
  Library: Use Winspool.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.

See Also

Printing and Print Spooler Overview, Printing and Print Spooler Functions, DEVMODE, DOCINFO, DocumentProperties, GetDeviceCaps, GetProcAddress, LoadLibrary, POINT, StartDoc


Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content      
question      mjs166   |   Edit   |  
DC_STAPLE can be queried, but how do you tell a printer to staple a document?
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker