Click or drag to resize

PrintingDevice.DeviceCapabilities Method (Typed)

X#
Obtain information about the capabilities printing device.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VOGUIClasses (in XSharp.VOGUIClasses.dll) Version: 2.21
Syntax
 VIRTUAL METHOD DeviceCapabilities(
	wCapability
) AS USUAL CLIPPER
Request Example View Source

Parameters

wCapability (Optional)
Type: Usual
The capability to be queried, specified by a Windows API device capability constant. For example, you might specify: 'DC_PAPERNAMES' If omitted, the default capability is used.

Return Value

Type: Usual
A usual variable containing a X# dynamic array or WORD. A value represented by the constant CAPABILITY_NOT_AVAILABLE indicates that the attempt to retrieve the value was unsuccessful. The return value varies according to the kCapability. Refer to the Windows SDK topic on DeviceCapabilites for return values. If the SDK indicates that the return value is an array or a point structure then the return value will contain a VO dynamic array; otherwise it will contain a word.
Remarks
This method provides information about the capabilities of a printing device object.
Examples
This is an example of a ListBox FillUsing method to populate the list box with a two dimensional array containing available paper sizes. The first dimension contains the display values and the second the return values.
X#
 1SELF:oPrint is assumed to be a Printer object
 2METHOD FillPaperSizesListBox() CLASS; MyPrintReportWindow
 3LOCAL aDisplayValues, aReturnValues, aListBoxValues;
 4:= {} AS ARRAY
 5LOCAL     i, wALen AS DWORD
 6aDisplayValues :=;
 7SELF:oPrint:PrintingDevice:DeviceCapabilities;
 8(DC_PAPERNAMES)
 9aReturnValues    :=;
10SELF:oPrint:PrintingDevice:DeviceCapabilities;
11(DC_PAPERS)
12wALen := ALen(aDisplayValues)
13FOR i := 1 UPTO wALen
14aAdd(aListBoxValues,;
15{aDisplayValues[i],;
16aReturnValues[i]})
17NEXT
18RETURN aListBoxValues
This example creates a Printer object using the default device driver. Various device capabilities are queried and displayed.
X#
 1LOCAL uValue            AS USUAL
 2LOCAL oP, oPD       AS OBJECT
 3// Create Printer object using default device and
 4// get reference to PrintingDevice object
 5oP := Printer{}
 6oPD := oP:PrintingDevice
 7// List names of available paper sizes
 8uValue := oPD:DeviceCapabilities(DC_PAPERNAMES)
 9QOut("Show "+"DC_PAPERNAMES")
10ShowValue(uValue)
11InKey(0)
12// List names of available bins
13uValue := oPD:DeviceCapabilities(DC_PAPERNAMES)
14QOut("Show "+"DC_PAPERNAMES")
15ShowValue(uValue)
16InKey(0)
17// Destroy printer object (reclaim GDI resources)
18oP:Destroy()
19FUNCTION ShowValue(uValue)
20IF IsArray(uValue)
21AEval(uValue, {|u| ShowValue(u)});
22// recurse until single element found
23ELSEIF IsNumeric(uValue) .AND.;
24uValue = CAPABILITY_NOT_AVAIALBLE
25QOut ("Device capability not available;
26from driver")
27ELSE
28QOut(uValue)
29ENDIF
See Also