DeviceCapabilitiesEx

  int DeviceCapabilitiesEx(lpDriverName, lpDeviceName, lpPort, iIndex, lpOutput, lpDevMode)    
  LPSTR lpDriverName;    
  LPSTR lpDeviceName;    
  LPSTR lpPort;    
  int iIndex;    
  LPSTR lpOutput;    
  LPDEVMODE lpDevMode;    

The DeviceCapabilitiesEx function retrieves capabilities of the device driver.

Parameters

lpDriverName

Points to a null-terminated character string that specifies the name of the device driver (for example, “Epson”).

lpDeviceName

Points to a null-terminated character string that specifies the name of the specific device to be supported (for example, “Epson FX-80”). The lpDeviceName parameter is used if the device driver supports more than one device.

lpPort

Points to a null-terminated character string that specifies the file or device name for the physical output medium (file or output port such as “LPT1”).

iIndex

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 pOutput 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 structure for information on these values. An application can determine the name of device-specific bins by using the ENUMPAPERBINS escape.
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_ENUMRESOLUTIONS Returns a list of available resolutions. If lpOutput is NULL, the function returns the number of available resolution configurations. Resolutions are represented by pairs of LONG integers representing the horizontal and vertical 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 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_FILEDEPENDENCIES Returns a list of files which also need to be loaded when a driver is installed. If lpOutput is NULL, the function returns the number of files. If lpOutput is not NULL, it is a pointer to an array of filenames in the form char[chFileName, 64]. This information is used by the PostScript driver to return the WPD filename if the printer model is an external printer. Mini-drivers return the generic library and external color brute library if color is present.
DC_MAXEXTENT Returns a POINT structure containing the maximum paper size that the dmPaperLength and dmPaperWidth fields of the printer driver's DEVMODE structure can specify.
DC_MINEXTENT Returns a POINT structure containing the minimum paper size that the dmPaperLength and dmPaperWidth fields of the printer driver's DEVMODE structure can specify.
DC_PAPERS Retrieves a list of supported paper sizes. The function copies the list to pOutput as a WORD array and returns the number of entries in the array. If pOutput 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

Points to an array of bytes. The actual format of the array depends on the setting of iIndex. If set to zero, DeviceCapabilitiesEx returns the number of bytes required for the output data.

lpDevMode

Points to a DEVMODE 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 iIndex parameter; see the description of that parameter for details. However, GDI_ERROR will be returned in the case of an error.