PrinterInformation.PortName Property

Gets the name of the port that the printer is on

[Visual Basic]
Public ReadOnly Property PortName As String
[C#]
public  string PortName {get;}
[C++]
public: __property  string get_PortName();
[JScript]
public function get PortName() : string;

Property Value

Gets the name of the port that the printer is on

Remarks

Example

[Visual Basic] The following example prints the details of a printer that is being monitored, whenever it is changed.

[Visual Basic] 
Private mPr As PrinterMonitorComponent

Public Sub StartWatching(ByVal PrinterDeviceName As String)

   mPr = New PrinterMonitorComponent()

   '\\ For efficieny reasons, do not monitor printer information changed events
   mPr.MonitorPrinterChangeEvent = False

   AddHandler mPr.PrinterChanged, AddressOf PrinterInfoChangetest

   mPr.ThreadTimeout = -1
   mPr.DeviceName = PrinterDeviceName 
   
   
End Sub

Public Sub PrinterInfoChangetest(ByVal sender As Object, ByVal e As EventArgs)

   With CType(e, PrinterEventArgs).PrinterInformation
       Trace.WriteLine("******* Printer Change Event ************")
       Trace.WriteLine(" Pages per month: " & .AveragePagesPerMonth.ToString)
       Trace.WriteLine(" Comment: " & .Comment)
       Trace.WriteLine(" Default Data Type: " & .DefaultDataType)
       Trace.WriteLine(" Driver name " & .DriverName)
       Trace.WriteLine(" Total jobs: " & .JobCount.ToString)
       Trace.WriteLine(" Location: " & .Location)
       Trace.WriteLine(" Parameters: " & .Parameters)
       Trace.WriteLine(" Port Name: " & .PortName)
       Trace.WriteLine(" Printer name: " & .PrinterName)
       Trace.WriteLine(" Processor: " & .PrintProcessor)
       Trace.WriteLine(" Seperator File:" & .SeperatorFilename)
       Trace.WriteLine(" Server name: " & .ServerName)
       Trace.WriteLine(" Share name: " & .ShareName)
   End With

End Sub

Requirements

Namespace: PrinterQueueWatch

Platforms:  Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family

See Also

PrinterInformation overview , All PrinterInformation members


© 2003 Merrion Computing Ltd. All rights reserved.