Click or drag to resize

PrintingDevice.GetDevMode Method

X#
Retrieve a pointer to the DevMode structure.

Namespace:  VO
Assembly:  VOGUIClasses (in VOGUIClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD GetDevMode() AS USUAL
Request Example View Source

Return Value

Type: Usual
A pointer to the DevMode structure or 0 if the structure is inaccessible. You should store this pointer in a variable typed "AS _WINDEVMODE".
Remarks
The DevMode structure is documented in the Win32 SDK and is defined in the X# Win32 API Library. This structure resides in the underlying PrintingDevice object and is created by using the device driver associated with the object. Updates to members of this structure are applied via the PrintingDevice:UpdateDevMode() method.
Examples
This example accesses and displays various information from the DevMode structure:
X#
 1oPD is assumed to be a PrintingDevice object.
 2LOCAL structDevMode    AS _WINDEVMODE
 3LOCAL i        AS DWORD
 4LOCAL cDeviceName    AS STRING
 5LOCAL cOrientation    AS STRING
 6structDevMode := oPD:GetDevMode()
 7FOR i := 1 TO CCHDEVICENAME
 8cDeviceName:=cDeviceName+Chr(structDevMode.dmDeviceName[i])
 9NEXT
10?"Device name is "
11??cDeviceName
12cOrientation := StringdmOrientation(structDevMode.dmOrientation)
13?"Orientation is "
14??cOrientation
15?"PaperLength is "
16??AllTrim(Str(structDevMode.dmPaperLength))
17?"PaperWidth is "
18??AllTrim(Str(structDevMode.dmPaperWidth))
19?"Number of copies is "
20??AllTrim(Str(structDevMode.dmCopies))
21? "dmDefaultSource "
22?structDevMode.dmDefaultSource
23Wait
24FUNCTION StringdmOrientation(nO AS SHORTINT) AS STRING
25IF nO = DMORIENT_LANDSCAPE
26RETURN "Landscape"
27ELSEIF nO = DMORIENT_PORTRAIT
28RETURN "Portrait"
29ELSE
30RETURN "Unknown"
31ENDIF
See Also