Platforms to show: All Mac Windows Linux Cross-Platform
/Win/Printing/Windows Printer List
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Printing/Windows Printer List
This example is the version from Sun, 17th Mar 2012.
Project "Windows Printer List.xojo_binary_project"
Class MainWindow Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Which Inherits Slider
ControlInstance Which Inherits Slider
EventHandler Sub ValueChanged()
update
End EventHandler
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control StaticText7 Inherits Label
ControlInstance StaticText7 Inherits Label
End Control
Control StaticText8 Inherits Label
ControlInstance StaticText8 Inherits Label
End Control
Control StaticText9 Inherits Label
ControlInstance StaticText9 Inherits Label
End Control
Control StaticText10 Inherits Label
ControlInstance StaticText10 Inherits Label
End Control
Control StaticText11 Inherits Label
ControlInstance StaticText11 Inherits Label
End Control
Control StaticText12 Inherits Label
ControlInstance StaticText12 Inherits Label
End Control
Control servername Inherits Label
ControlInstance servername Inherits Label
End Control
Control PrinterName Inherits Label
ControlInstance PrinterName Inherits Label
End Control
Control ShareName Inherits Label
ControlInstance ShareName Inherits Label
End Control
Control PortName Inherits Label
ControlInstance PortName Inherits Label
End Control
Control DriverName Inherits Label
ControlInstance DriverName Inherits Label
End Control
Control Comment Inherits Label
ControlInstance Comment Inherits Label
End Control
Control Location Inherits Label
ControlInstance Location Inherits Label
End Control
Control SepFile Inherits Label
ControlInstance SepFile Inherits Label
End Control
Control PrintProcessor Inherits Label
ControlInstance PrintProcessor Inherits Label
End Control
Control Datatype Inherits Label
ControlInstance Datatype Inherits Label
End Control
Control Parameters Inherits Label
ControlInstance Parameters Inherits Label
End Control
Control index Inherits Label
ControlInstance index Inherits Label
End Control
Control StaticText13 Inherits Label
ControlInstance StaticText13 Inherits Label
End Control
Control defaultprinter Inherits Label
ControlInstance defaultprinter Inherits Label
End Control
Control SetButton Inherits PushButton
ControlInstance SetButton Inherits PushButton
EventHandler Sub Action()
msgbox str(WindowsPrinterMBS.SetDefaultPrinter(Current.PrinterName))
defaultprinter.text=WindowsPrinterMBS.GetDefaultPrinter
End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
dim name as string = current.PrinterName
dim printer as WindowsPrinterMBS = current.OpenPrinter
if printer.CanPrinterPassThroughPostScript then
MsgBox "This printer can pass postscript."
else
MsgBox "No"
end if
End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action()
dim name as string = current.PrinterName
dim printer as WindowsPrinterMBS = current.OpenPrinter
MsgBox printer.GetPrinterTechnology
End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action()
dim printer as WindowsPrinterMBS = current.OpenPrinter
dim c as WindowsDeviceModeMBS // current settings
c = printer.GetPrinterSettings(9) // user
if c = nil then
c = printer.GetPrinterSettings(2) // printer
end if
dim d as new WindowsDeviceModeMBS
d.Fields = d.DM_ORIENTATION // here we define which values we want to change
// and set values
if c.Orientation = d.DMORIENT_LANDSCAPE then
d.Orientation = d.DMORIENT_PORTRAIT
else
d.Orientation = d.DMORIENT_LANDSCAPE
end if
// apply changes.
if printer.ChangePrinterSettings(d, 2) then
MsgBox "OK"
update
else
MsgBox "Failed: "+printer.LasterrorMessage
end if
End EventHandler
End Control
Control Liste Inherits Listbox
ControlInstance Liste Inherits Listbox
End Control
EventHandler Sub Open()
if not TargetWin32 then
MsgBox "This example must be run on Windows."
Return
end if
dim c as integer
printers = WindowsPrinterInfoMBS.LocalPrinters
defaultprinter.text = WindowsPrinterMBS.GetDefaultPrinter
c=UBound(printers)
if c = -1 then
else
current = printers(0)
which.Maximum=c
which.Enabled=true
end if
update
End EventHandler
Function GetCollateString(n as integer) As String
Select case n
case WindowsDeviceModeMBS.DMCOLLATE_FALSE
Return "false"
case WindowsDeviceModeMBS.DMCOLLATE_TRUE
Return "true"
end Select
End Function
Function GetColorString(n as integer) As String
Select case n
case WindowsDeviceModeMBS.DMCOLOR_MONOCHROME
Return "monochrome"
case WindowsDeviceModeMBS.DMCOLOR_COLOR
Return "color"
end Select
End Function
Function GetDefaultSourceString(n as integer) As string
Select case n
case WindowsDeviceModeMBS.DMBIN_UPPER
Return "upper"
case WindowsDeviceModeMBS.DMBIN_ONLYONE
Return "only one"
case WindowsDeviceModeMBS.DMBIN_LOWER
Return "lower"
case WindowsDeviceModeMBS.DMBIN_MIDDLE
Return "middle"
case WindowsDeviceModeMBS.DMBIN_MANUAL
Return "manual"
case WindowsDeviceModeMBS.DMBIN_ENVELOPE
Return "envelope"
case WindowsDeviceModeMBS.DMBIN_ENVMANUAL
Return "envmanual"
case WindowsDeviceModeMBS.DMBIN_AUTO
Return "auto"
case WindowsDeviceModeMBS.DMBIN_TRACTOR
Return "tractor"
case WindowsDeviceModeMBS.DMBIN_SMALLFMT
Return "small format"
case WindowsDeviceModeMBS.DMBIN_LARGEFMT
Return "large format"
case WindowsDeviceModeMBS.DMBIN_LARGECAPACITY
Return "Large Capacity"
case WindowsDeviceModeMBS.DMBIN_CASSETTE
Return "Cassette"
case WindowsDeviceModeMBS.DMBIN_FORMSOURCE
Return "FormSource"
case WindowsDeviceModeMBS.DMBIN_USER
Return "User" // device specific bins start here
end Select
End Function
Function GetDuplexString(n as integer) As string
Select case n
case WindowsDeviceModeMBS.DMDUP_SIMPLEX
Return "simplex"
case WindowsDeviceModeMBS.DMDUP_VERTICAL
Return "duplex vertical"
case WindowsDeviceModeMBS.DMDUP_HORIZONTAL
Return "duplex horizontal"
end Select
End Function
Function GetPrintQualityString(n as integer) As string
Select case n
case WindowsDeviceModeMBS.DMRES_DRAFT
Return "draft"
case WindowsDeviceModeMBS.DMRES_LOW
Return "low"
case WindowsDeviceModeMBS.DMRES_MEDIUM
Return "medium"
case WindowsDeviceModeMBS.DMRES_HIGH
Return "high"
end Select
End Function
Function GetTrueTypeString(n as integer) As String
Select case n
case WindowsDeviceModeMBS.DMTT_BITMAP
Return "bitmap"
case WindowsDeviceModeMBS.DMTT_DOWNLOAD
Return "download"
case WindowsDeviceModeMBS.DMTT_SUBDEV
Return "subdev"
case WindowsDeviceModeMBS.DMTT_DOWNLOAD_OUTLINE
Return "download outline"
end Select
End Function
Function getOrientationString(n as integer) As string
Select case n
case WindowsDeviceModeMBS.DMORIENT_PORTRAIT
Return "Portrait"
case WindowsDeviceModeMBS.DMORIENT_LANDSCAPE
Return "Landscape"
end Select
End Function
Function getPaperSizeString(n as integer) As string
Select case n
case WindowsDeviceModeMBS.DMPAPER_LETTER
return"Letter 8 1/2 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_LETTERSMALL
return"Letter Small 8 1/2 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_TABLOID
return"Tabloid 11 x 17 in"
case WindowsDeviceModeMBS.DMPAPER_LEDGER
return"Ledger 17 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_LEGAL
return"Legal 8 1/2 x 14 in"
case WindowsDeviceModeMBS.DMPAPER_STATEMENT
return"Statement 5 1/2 x 8 1/2 in"
case WindowsDeviceModeMBS.DMPAPER_EXECUTIVE
return"Executive 7 1/4 x 10 1/2 in"
case WindowsDeviceModeMBS.DMPAPER_A3
return"A3 297 x 420 mm"
case WindowsDeviceModeMBS.DMPAPER_A4
return"A4 210 x 297 mm"
case WindowsDeviceModeMBS.DMPAPER_A4_SMALL
return"A4 Small 210 x 297 mm"
case WindowsDeviceModeMBS.DMPAPER_A5
return"A5 148 x 210 mm"
case WindowsDeviceModeMBS.DMPAPER_B4
return"B4 (JIS) 250 x 354"
case WindowsDeviceModeMBS.DMPAPER_B5
return"B5 (JIS) 182 x 257 mm"
case WindowsDeviceModeMBS.DMPAPER_FOLIO
return"Folio 8 1/2 x 13 in"
case WindowsDeviceModeMBS.DMPAPER_QUARTO
return"Quarto 215 x 275 mm"
case WindowsDeviceModeMBS.DMPAPER_10x14
return"10x14 in"
case WindowsDeviceModeMBS.DMPAPER_11X17
return"11x17 in"
case WindowsDeviceModeMBS.DMPAPER_NOTE
return"Note 8 1/2 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_ENV_9
return"Envelope #9 3 7/8 x 8 7/8"
case WindowsDeviceModeMBS.DMPAPER_ENV_10
return"Envelope #10 4 1/8 x 9 1/2"
case WindowsDeviceModeMBS.DMPAPER_ENV_11
return"Envelope #11 4 1/2 x 10 3/8"
case WindowsDeviceModeMBS.DMPAPER_ENV_12
return"Envelope #12 4 \276 x 11"
case WindowsDeviceModeMBS.DMPAPER_ENV_14
return"Envelope #14 5 x 11 1/2"
case WindowsDeviceModeMBS.DMPAPER_CSHEET
return"C size sheet"
case WindowsDeviceModeMBS.DMPAPER_DSHEET
return"D size sheet"
case WindowsDeviceModeMBS.DMPAPER_ESHEET
return"E size sheet"
case WindowsDeviceModeMBS.DMPAPER_ENV_DL
return"Envelope DL 110 x 220mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_C5
return"Envelope C5 162 x 229 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_C3
return"Envelope C3 324 x 458 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_C4
return"Envelope C4 229 x 324 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_C6
return"Envelope C6 114 x 162 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_C65
return"Envelope C65 114 x 229 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_B4
return"Envelope B4 250 x 353 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_B5
return"Envelope B5 176 x 250 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_B6
return"Envelope B6 176 x 125 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_ITALY
return"Envelope 110 x 230 mm"
case WindowsDeviceModeMBS.DMPAPER_ENV_MONARCH
return"Envelope Monarch 3.875 x 7.5 in"
case WindowsDeviceModeMBS.DMPAPER_ENV_PERSONAL
return"6 3/4 Envelope 3 5/8 x 6 1/2 in"
case WindowsDeviceModeMBS.DMPAPER_FANFOLD_US
return"US Std Fanfold 14 7/8 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_FANFOLD_STD_GERMAN
return"German Std Fanfold 8 1/2 x 12 in"
case WindowsDeviceModeMBS.DMPAPER_FANFOLD_LGL_GERMAN
return"German Legal Fanfold 8 1/2 x 13 in"
case WindowsDeviceModeMBS.DMPAPER_ISO_B4
return"B4 (ISO) 250 x 353 mm"
case WindowsDeviceModeMBS.DMPAPER_JAPANESE_POSTCARD
return"Japanese Postcard 100 x 148 mm"
case WindowsDeviceModeMBS.DMPAPER_9X11
return"9 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_10x11
return"10 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_15X11
return"15 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_ENV_INVITE
return"Envelope Invite 220 x 220 mm"
case WindowsDeviceModeMBS.DMPAPER_RESERVED_48
return"RESERVED--DO NOT USE"
case WindowsDeviceModeMBS.DMPAPER_RESERVED_49
return"RESERVED--DO NOT USE"
case WindowsDeviceModeMBS.DMPAPER_LETTER_EXTRA
return"Letter Extra 9 \275 x 12 in"
case WindowsDeviceModeMBS.DMPAPER_LEGAL_EXTRA
return"Legal Extra 9 \275 x 15 in"
case WindowsDeviceModeMBS.DMPAPER_TABLOID_EXTRA
return"Tabloid Extra 11.69 x 18 in"
case WindowsDeviceModeMBS.DMPAPER_A4_EXTRA
return"A4 Extra 9.27 x 12.69 in"
case WindowsDeviceModeMBS.DMPAPER_LETTER_TRANSVERSE
return"Letter Transverse 8 \275 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_A4_TRANSVERSE
return"A4 Transverse 210 x 297 mm"
case WindowsDeviceModeMBS.DMPAPER_LETTER_EXTRA_TRANSVERSE
return"Letter Extra Transverse 9\275 x 12 in"
case WindowsDeviceModeMBS.DMPAPER_A_PLUS
return"SuperA/SuperA/A4 227 x 356 mm"
case WindowsDeviceModeMBS.DMPAPER_B_PLUS
return"SuperB/SuperB/A3 305 x 487 mm"
case WindowsDeviceModeMBS.DMPAPER_LETTER_PLUS
return"Letter Plus 8.5 x 12.69 in"
case WindowsDeviceModeMBS.DMPAPER_A4_PLUS
return"A4 Plus 210 x 330 mm"
case WindowsDeviceModeMBS.DMPAPER_A5_TRANSVERSE
return"A5 Transverse 148 x 210 mm"
case WindowsDeviceModeMBS.DMPAPER_B5_TRANSVERSE
return"B5 (JIS) Transverse 182 x 257 mm"
case WindowsDeviceModeMBS.DMPAPER_A3_EXTRA
return"A3 Extra 322 x 445 mm"
case WindowsDeviceModeMBS.DMPAPER_A5_EXTRA
return"A5 Extra 174 x 235 mm"
case WindowsDeviceModeMBS.DMPAPER_B5_EXTRA
return"B5 (ISO) Extra 201 x 276 mm"
case WindowsDeviceModeMBS.DMPAPER_A2
return"A2 420 x 594 mm"
case WindowsDeviceModeMBS.DMPAPER_A3_TRANSVERSE
return"A3 Transverse 297 x 420 mm"
case WindowsDeviceModeMBS.DMPAPER_A3_EXTRA_TRANSVERSE
return"A3 Extra Transverse 322 x 445 mm"
case WindowsDeviceModeMBS.DMPAPER_DBL_JAPANESE_POSTCARD
return"Japanese Double Postcard 200 x 148 mm"
case WindowsDeviceModeMBS.DMPAPER_A6
return"A6 105 x 148 mm"
case WindowsDeviceModeMBS.DMPAPER_JENV_KAKU2
return"Japanese Envelope Kaku #2"
case WindowsDeviceModeMBS.DMPAPER_JENV_KAKU3
return"Japanese Envelope Kaku #3"
case WindowsDeviceModeMBS.DMPAPER_JENV_CHOU3
return"Japanese Envelope Chou #3"
case WindowsDeviceModeMBS.DMPAPER_JENV_CHOU4
return"Japanese Envelope Chou #4"
case WindowsDeviceModeMBS.DMPAPER_LETTER_ROTATED
return"Letter Rotated 11 x 8 1/2 11 in"
case WindowsDeviceModeMBS.DMPAPER_A3_ROTATED
return"A3 Rotated 420 x 297 mm"
case WindowsDeviceModeMBS.DMPAPER_A4_ROTATED
return"A4 Rotated 297 x 210 mm"
case WindowsDeviceModeMBS.DMPAPER_A5_ROTATED
return"A5 Rotated 210 x 148 mm"
case WindowsDeviceModeMBS.DMPAPER_B4_JIS_ROTATED
return"B4 (JIS) Rotated 364 x 257 mm"
case WindowsDeviceModeMBS.DMPAPER_B5_JIS_ROTATED
return"B5 (JIS) Rotated 257 x 182 mm"
case WindowsDeviceModeMBS.DMPAPER_JAPANESE_POSTCARD_ROTATED
return"Japanese Postcard Rotated 148 x 100 mm"
case WindowsDeviceModeMBS.DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED
return"Double Japanese Postcard Rotated 148 x 200 mm"
case WindowsDeviceModeMBS.DMPAPER_A6_ROTATED
return"A6 Rotated 148 x 105 mm"
case WindowsDeviceModeMBS.DMPAPER_JENV_KAKU2_ROTATED
return"Japanese Envelope Kaku #2 Rotated"
case WindowsDeviceModeMBS.DMPAPER_JENV_KAKU3_ROTATED
return"Japanese Envelope Kaku #3 Rotated"
case WindowsDeviceModeMBS.DMPAPER_JENV_CHOU3_ROTATED
return"Japanese Envelope Chou #3 Rotated"
case WindowsDeviceModeMBS.DMPAPER_JENV_CHOU4_ROTATED
return"Japanese Envelope Chou #4 Rotated"
case WindowsDeviceModeMBS.DMPAPER_B6_JIS
return"B6 (JIS) 128 x 182 mm"
case WindowsDeviceModeMBS.DMPAPER_B6_JIS_ROTATED
return"B6 (JIS) Rotated 182 x 128 mm"
case WindowsDeviceModeMBS.DMPAPER_12X11
return"12 x 11 in"
case WindowsDeviceModeMBS.DMPAPER_JENV_YOU4
return"Japanese Envelope You #4"
case WindowsDeviceModeMBS.DMPAPER_JENV_YOU4_ROTATED
return"Japanese Envelope You #4 Rotated"
case WindowsDeviceModeMBS.DMPAPER_P16K
return"PRC 16K 146 x 215 mm"
case WindowsDeviceModeMBS.DMPAPER_P32K
return"PRC 32K 97 x 151 mm"
case WindowsDeviceModeMBS.DMPAPER_P32KBIG
return"PRC 32K(Big) 97 x 151 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_1
return"PRC Envelope #1 102 x 165 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_2
return"PRC Envelope #2 102 x 176 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_3
return"PRC Envelope #3 125 x 176 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_4
return"PRC Envelope #4 110 x 208 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_5
return"PRC Envelope #5 110 x 220 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_6
return"PRC Envelope #6 120 x 230 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_7
return"PRC Envelope #7 160 x 230 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_8
return"PRC Envelope #8 120 x 309 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_9
return"PRC Envelope #9 229 x 324 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_10
return"PRC Envelope #10 324 x 458 mm"
case WindowsDeviceModeMBS.DMPAPER_P16K_ROTATED
return"PRC 16K Rotated"
case WindowsDeviceModeMBS.DMPAPER_P32K_ROTATED
return"PRC 32K Rotated"
case WindowsDeviceModeMBS.DMPAPER_P32KBIG_ROTATED
return"PRC 32K(Big) Rotated"
case WindowsDeviceModeMBS.DMPAPER_PENV_1_ROTATED
return"PRC Envelope #1 Rotated 165 x 102 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_2_ROTATED
return"PRC Envelope #2 Rotated 176 x 102 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_3_ROTATED
return"PRC Envelope #3 Rotated 176 x 125 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_4_ROTATED
return"PRC Envelope #4 Rotated 208 x 110 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_5_ROTATED
return"PRC Envelope #5 Rotated 220 x 110 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_6_ROTATED
return"PRC Envelope #6 Rotated 230 x 120 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_7_ROTATED
return"PRC Envelope #7 Rotated 230 x 160 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_8_ROTATED
return"PRC Envelope #8 Rotated 309 x 120 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_9_ROTATED
return"PRC Envelope #9 Rotated 324 x 229 mm"
case WindowsDeviceModeMBS.DMPAPER_PENV_10_ROTATED
return"PRC Envelope #10 Rotated 458 x 324 mm"
end Select
End Function
Sub update()
List.DeleteAllRows
Liste.DeleteAllRows
dim i as integer = which.Value
Current=Printers(i)
index.text=str(i)
if current<>nil then
servername.text = current.ServerName
PrinterName.text = current.PrinterName
ShareName.text = current.ShareName
PortName.text = current.PortName
DriverName.text = current.DriverName
Comment.text = current.Comment
Location.text = current.Location
SepFile.text = current.SeparatorPageFile
PrintProcessor.text = current.PrintProcessor
Datatype.text = current.Datatype
Parameters.text = current.Parameters
SetButton.Enabled=true
// Update the printer settings listbox:
dim pd as WindowsDeviceModeMBS = current.DevMode
dim printer as WindowsPrinterMBS = current.OpenPrinter
dim pg as WindowsDeviceModeMBS = printer.GetPrinterSettings(8) // 8 = global
dim pu as WindowsDeviceModeMBS = printer.GetPrinterSettings(9) // 9 = user
dim fields as integer = 0
if pd<>Nil then
fields = pd.Fields
elseif pg<>Nil then
fields = pg.Fields
elseif pu<>Nil then
fields = pu.Fields
end if
List.AddRow "DeviceName"
if pd<>nil then
List.cell(List.LastIndex,2)=pd.DeviceName
end if
if pg<>nil then
List.cell(List.LastIndex,3)=pg.DeviceName
end if
if pu<>nil then
List.cell(List.LastIndex,4)=pu.DeviceName
end if
List.AddRow "FormName"
if pd<>nil then
List.cell(List.LastIndex,2)=pd.FormName
end if
if pg<>nil then
List.cell(List.LastIndex,3)=pg.FormName
end if
if pu<>nil then
List.cell(List.LastIndex,4)=pu.FormName
end if
List.AddRow "Orientation"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_ORIENTATION)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.Orientation)+" "+getOrientationString(pd.Orientation)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.Orientation)+" "+getOrientationString(pg.Orientation)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.Orientation)+" "+getOrientationString(pu.Orientation)
end if
List.AddRow "PaperSize"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_PAPERSIZE)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.PaperSize)+" "+getPaperSizeString(pd.PaperSize)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.PaperSize)+" "+getPaperSizeString(pg.PaperSize)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.PaperSize)+" "+getPaperSizeString(pu.PaperSize)
end if
List.AddRow "PaperLength"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_PAPERLENGTH)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.PaperLength)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.PaperLength)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.PaperLength)
end if
List.AddRow "PaperWidth"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_PAPERWIDTH)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.PaperWidth)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.PaperWidth)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.PaperWidth)
end if
List.AddRow "Scale"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_SCALE)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.Scale)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.Scale)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.Scale)
end if
List.AddRow "Copies"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_COPIES)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.Copies)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.Copies)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.Copies)
end if
List.AddRow "DefaultSource"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_DEFAULTSOURCE)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.DefaultSource)+" "+GetDefaultSourceString(pd.DefaultSource)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.DefaultSource)+" "+GetDefaultSourceString(pg.DefaultSource)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.DefaultSource)+" "+GetDefaultSourceString(pu.DefaultSource)
end if
List.AddRow "PrintQuality"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_PRINTQUALITY)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.PrintQuality)+" "+GetPrintQualityString(pd.PrintQuality)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.PrintQuality)+" "+GetPrintQualityString(pg.PrintQuality)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.PrintQuality)+" "+GetPrintQualityString(pu.PrintQuality)
end if
List.AddRow "Color"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_COLOR)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.Color)+" "+GetColorString(pd.Color)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.Color)+" "+GetColorString(pg.Color)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.Color)+" "+GetColorString(pu.Color)
end if
List.AddRow "Duplex"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_DUPLEX)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.Duplex)+" "+GetDuplexString(pd.Duplex)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.Duplex)+" "+GetDuplexString(pg.Duplex)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.Duplex)+" "+GetDuplexString(pu.Duplex)
end if
List.AddRow "YResolution"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_YRESOLUTION)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.YResolution)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.YResolution)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.YResolution)
end if
List.AddRow "TTOption"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_TTOPTION)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.TTOption)+" "+GetTrueTypeString(pd.TTOption)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.TTOption)+" "+GetTrueTypeString(pg.TTOption)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.TTOption)+" "+GetTrueTypeString(pu.TTOption)
end if
List.AddRow "Collate"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_COLLATE)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.Collate)+" "+GetCollateString(pd.Collate)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.Collate)+" "+GetCollateString(pg.Collate)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.Collate)+" "+GetCollateString(pu.Collate)
end if
List.AddRow "LogPixels"
if BitwiseAnd(fields, WindowsDeviceModeMBS.DM_LOGPIXELS)<>0 then
List.cell(List.LastIndex,1)="yes"
else
List.cell(List.LastIndex,1)="no"
end if
if pd<>nil then
List.cell(List.LastIndex,2)=str(pd.LogPixels)
end if
if pg<>nil then
List.cell(List.LastIndex,3)=str(pg.LogPixels)
end if
if pu<>nil then
List.cell(List.LastIndex,4)=str(pu.LogPixels)
end if
// Update the page format listbox:
dim formats(-1) as WindowsPageFormatMBS = printer.GetPrinterFormats
for each f as WindowsPageFormatMBS in Formats
Liste.AddRow f.Name
dim s as string
Select case f.Flags
case f.FORM_USER
s = "user"
case f.FORM_PRINTER
s = "printer"
case f.FORM_BUILTIN
s = "built-in"
end Select
liste.Cell(liste.LastIndex,1)=s
liste.Cell(liste.LastIndex,2)=Format(f.SizeWidth/1000,"0.00")+"mm x "+Format(f.SizeHeight/1000,"0.00")+"mm"
next
end if
End Sub
Property Protected Current As WindowsPrinterInfoMBS
Property Protected Printers() As WindowsPrinterInfoMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Win Plugin.