Thanks for this Herfried - it seems like a lot of work but I can follow the
example pretty well. Thanks for the link to the WMI documentation. One
thing - this example iterates thru all the available printers. How do I know
which one is the default printer?
"Herfried K. Wagner [MVP]" <hirf.nosp@m.activevb.de> wrote in message
news:#kSXDW$bDHA.616@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hello,
>
> "Raymond Martin" <raym198@bellsouth.net> schrieb:[color=green]
> > How do I find out if the default printer is offline or online (or has a
> > paper jam)?[/color]
>
> \\\
> Private Enum PrinterStatus
> PrinterIdle = 3
> PrinterPrinting = 4
> PrinterWarmingUp = 5
> ' For more states see WMI docs.
> End Enum
>
> Private Function PrinterStatusToString( _
> ByVal ps As PrinterStatus _
> ) As String
> Dim s As String
> Select Case ps
> Case PrinterStatus.PrinterIdle
> s = "waiting (idle)"
> Case PrinterStatus.PrinterPrinting
> s = "printing"
> Case PrinterStatus.PrinterWarmingUp
> s = "warming up"
> Case Else ' Vielleicht gibt es noch weitere Fälle...
> s = "unknown state"
> End Select
> Return s
> End Function
>
> Private Sub Form1_Load( _
> ByVal sender As System.Object, _
> ByVal e As System.EventArgs _
> ) Handles MyBase.Load
> Dim strPrintServer As String
> strPrintServer = "localhost"
> Dim WMIObject As String, PrinterSet As Object, Printer As Object
> WMIObject = "winmgmts://" & strPrintServer
> PrinterSet = GetObject(WMIObject).InstancesOf("win32_Printer")
> For Each Printer In PrinterSet
> MsgBox( _
> Printer.Name & ": " & _
> PrinterStatusToString(Printer.PrinterStatus) _
> )
> Next Printer
> End Sub
> ///
>
> Documentation of WMI classes:
>
>[/color]
http://msdn.microsoft.com/library/de...us/wmisdk/wmi/
wmi_classes.asp[color=blue]
>
> HTH,
> Herfried K. Wagner
> --
> MVP · VB Classic, VB .NET
>
http://www.mvps.org/dotnet
>
>[/color]