DeviceCapabilities

Version 3.0

Syntax

DWORD DeviceCapabilities(lpDeviceName,lpPort,nIndex,lpOutput,lpDevMode)

This function retrieves the capabilities of the printer device driver.

Parameter Type/Description  
lpDeviceName LPSTR Points to a null-terminated character string that contains the name of the printer device, such as “PCL/HP LaserJet.”  
lpPort LPSTR Points to a null-terminated character string that contains the name of the port to which the device is connected, such as LPT1:.  
Parameter Type/Description  
nIndex WORD Specifies the capabilities to query. It can be any one of the following values:  
  Value Meaning
  DC_BINNAMES Copies a structure identical to that returned by the ENUMPAPERBINS escape. A printer driver does not need to support this index if it has only bins corresponding to predefined indexes, in which case no data is copied and the return value is 0. If the index is supported, the return value is the number of bins copied. If lpOutput is NULL, the return value is the number of bin entries required.
  DC_BINS Retrieves a list of available bins. The function copies the list to lpOutput as a WORD array. If lpOutput is NULL, the function returns the number of supported bins to allow the application the opportunity to allocate a buffer with the correct size. See the description of the dmDefaultSource field of the DEVMODE data structure for information on these values. An application can determine the name of device-specific bins by using the ENUMPAPERBINS escape.
Parameter Type/Description  
  Value Meaning
  DC_DRIVER Returns the printer driver version number.
  DC_DUPLEX Returns the level of duplex support. The function returns 1 if the printer is capable of duplex printing. Otherwise, the return value is zero.
  DC_EXTRA Returns the number of bytes required for the device-specific portion of the DEVMODE data structure for the printer driver.
  DC_FIELDS Returns the dmFields field of the printer driver's DEVMODE data structure. The dmFields bitfield indicates which fields in the device-independent portion of the structure are supported by the printer driver.
  DC_MAXEXTENT Returns a POINT data structure containing the maximum paper size that the dmPaperLength and dmPaperWidth fields of the printer driver's DEVMODE data structure can specify.
  DC_MINEXTENT Returns a POINT data structure containing the minimum paper size that the dmPaperLength and dmPaperWidth fields of the printer driver's DEVMODE data structure can specify.
Parameter Type/Description  
  Value Meaning
  DC_PAPERS Retrieves a list of supported paper sizes. The function copies the list to lpOutput as a WORD array and returns the number of entries in the array. If lpOutput is NULL, the function returns the number of supported paper sizes to allow the application the opportunity to allocate a buffer with the correct size. See the description of the dmPaperSize field of the DEVMODE data structure for information on these values.
  DC_PAPERSIZE Copies the dimensions of supported paper sizes in tenths of a millimeter to an array of POINT structures in lpOutput. This allows an application to obtain information about nonstandard paper sizes.
  DC_SIZE Returns the dmSize field of the printer driver's DEVMODE data structure.
  DC_VERSION Returns the specification version to which the printer driver conforms.
lpOutput LPSTR Points to an array of bytes. The actual format of the array depends on the setting of nIndex. If set to zero, DeviceCapabilities returns the number of bytes required for the output data.  
lpDevMode DEVMODE FAR * Points to a DEVMODE data structure. If lpDevMode is NULL, this function retrieves the current default initialization values for the specified printer driver. Otherwise, the function retrieves the values contained in the structure to which lpDevMode points.  

Return Value

The return value depends on the setting of the nIndex parameter; see the description of that parameter for details.

Comments

This function is supplied by the printer driver. An application must include the DRIVINIT.H file and call the LoadLibrary and GetProcAddress functions to call the DeviceCapabilities function.