Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Windows Switch Printers for printing
Function:
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/Windows Switch Printers for printing
This example is the version from Thu, 19th Sep 2012.
Project "Windows Switch Printers for printing.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action() dim LocalPrinters() as WindowsPrinterInfoMBS = WindowsPrinterInfoMBS.LocalPrinters dim DefaultPrinter as string = WindowsPrinterMBS.GetDefaultPrinter for i as integer = 1 to 2 for each p as WindowsPrinterInfoMBS in LocalPrinters call WindowsPrinterMBS.SetDefaultPrinter(p.PrinterName) dim g as Graphics = OpenPrinter g.DrawString "Printing page "+str(i)+" on "+p.PrinterName, 100, 100 g = nil // close next next call WindowsPrinterMBS.SetDefaultPrinter(DefaultPrinter) End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open() dim LocalPrinters() as WindowsPrinterInfoMBS = WindowsPrinterInfoMBS.LocalPrinters for each p as WindowsPrinterInfoMBS in LocalPrinters list.AddRow p.PrinterName, p.PortName, p.ServerName next End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.





Links
MBS Xojo Plugins