PrintingDevice.DeviceCapabilities Method |
Namespace: VO
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
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