Printing
List of Printers currently installed
This gets the list of printers that are currently installed
Dim sPrinterName As String
For Each sPrinterName In System.Drawing.Printing.PrinterSettings.InstalledPrinters
System.Windows.Forms.MessageBox.Show(sPrinterName)
Next sPrinterName
Using the Windows Management Instrumentation (WMI) Library
This can be used to provide a list of all network printers.
It is an additional library though and therefore will require an additional reference (System.Management.dll)
Dim objSearcher As Management.ManagementObjectSearcher
Dim objCollectionResults As Management.ManagementObjectCollection
Dim objPrinter As Management.ManagementObject
objSearcher = New Management.ManagementObjectSearcher("Select * FROM Win32_Printer")
objCollectionResults = objSearcher.Get()
For Each objPrinter In objCollectionResults
System.Windows.Forms.MessageBox.Show(objPrinter.Name)
Next objPrinter
Information about the Default Printer
Printer settings can be accessed from within the PrintDocument object
Dim objPrintDocument As System.Drawing.Printing.PrintDocument
System.Windows.Forms.MessageBox.Show(objPrintDocument.PrinterSettings.PrintName)
objPrintDocument.PrintSettings.IsValid
Getting Display Dimensions
This will tell you the size of the users screen.
Dim objStringBuilder As System.Text.StringBuilder
Dim objScreen As Screen
'number of screens
Screen.AllScreens.Length.ToString
For Each objScreen In Screen.AllScreens
objScreen.DeviceName
objScreen.Bounds
objScreen.WorkingArea
objScreen.Primary
Next objScreen
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext