The DeviceCapabilities function retrieves the capabilities of a printer device driver.
Declare Function DeviceCapabilities Lib "winspool.drv" Alias "DeviceCapabilitiesA" (ByVal lpDeviceName As String, ByVal lpPort As String, ByVal iIndex As Long, ByVal lpOutput As String, lpDevMode As DEVMODE) As Long
|Operating Systems Supported|
|Requires Windows NT 3.1 or later; Requires Windows 95 or later|
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.
Pointer to a null-terminated string that contains the name of the port to which the device is connected, such as “LPT1”.
Specifies the capabilities to query. This parameter can be one of the following values:
Windows 95 only: 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:
Copies an array containing a list of the names of the paper bins. This array is in the form char PaperNames[cBinMax][cchBinName] where cchBinName is 24. If the pOutput parameter is NULL, the return value is the number of bin entries required. Otherwise, the return value is the number of bins copied.
Retrieves a list of available bins. The function copies the list to the pOutput parameter as a WORD array. If pOutput is NULL, the function returns the number of supported bins to allow the application the opportunity to allocate a buffer with the correct size. For more information about these bins, see the description of the dmDefaultSource member of the DEVMODE structure.
Returns the number of copies the device can print.
Returns the version number of the printer driver.
Windows 95 only: The return value is the number of datatypes supported by the printer driver. If the function returns -1, the driver understands the “RAW” datatype only. The names of the supported datatypes are copied to an array. Use the names in the DOCINFO structure when calling the StartDoc function to specify the datatype.
Returns the level of duplex support. The function returns 1 if the printer is capable of duplex printing. Otherwise, the return value is zero.
Windows 95 only: Determines if a printer driver supports enhanced metafile (EMF). A return value of 1 means the driver supports EMF. A return value of -1 means that the driver does not support EMF
Returns a list of available resolutions. If pOutput 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 (specified in dots per inch).
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.
Returns a list of files that also need to be loaded when a driver is installed. If the pOutput parameter is NULL, the function returns the number of files. Otherwise, pOutput points to an array of filenames in the form char[chFileName, 64]. Each filename is a null-terminated string.
Returns a POINTS structure that contains the maximum paper size that the dmPaperLength and dmPaperWidth members of the printer driver’s DEVMODE structure can specify. The x member of the POINTS structure contains the maximum dmPaperWidth value, and the y member contains the maximum dmPaperLength value.
Returns a POINTS structure that contains the minimum paper size that the dmPaperLength and dmPaperWidth members of the printer driver’s DEVMODE structure can specify. The x member of the POINTS structure contains the minimum dmPaperWidth value, and the y member 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:
No landscape orientation.
Portrait is rotated 90 degrees to produce landscape. (For example, Hewlett-Packard PCL printers.)
Portrait is rotated 270 degrees to produce landscape. (For example, dot-matrix printers.)
Retrieves a list of supported paper names (for example, Letter or Legal). If the pOutput parameter is NULL, the function returns the number of paper sizes available. Otherwise, pOutput points to an array for the paper names in the form char[cPaperNames, 64]. Each paper name is a null-terminated string.
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. For more information on paper sizes, see the description of the dmPaperSize member of the DEVMODE structure.
Copies the dimensions of all supported paper sizes, in tenths of a millimeter, to an array of POINT structures pointed to by the pOutput parameter. The width (x-dimension) and length (y-dimension) of a paper size are returned as if the paper were in the DMORIENT_PORTRAIT orientation.
Returns the dmSize member of the printer driver’s DEVMODE structure.
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:
Device can print TrueType fonts as graphics. (For example, dot-matrix and PCL printers.)
Device can download TrueType fonts. (For example, PCL and PostScript printers.)
Windows 95 only: Device can download outline TrueType fonts.
Device can substitute device fonts for TrueType fonts. (For example, PostScript printers.)
Returns the specification version to which the printer driver conforms.
Pointer to an array of bytes. The format of the array depends on the setting of the fwCapability parameter. If pOutput is zero, DeviceCapabilities returns the number of bytes required for the output data.
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. |
If the function fails, the return value is -1.