PrinterMonitorComponent.DeviceName Property

Set to the device name of the printer queue to be monitored.

[Visual Basic]
Public Property DeviceName As String
[C#]
public string DeviceName {get; set;}
[C++]
public: __property string get_DeviceName();
public: __property void set_DeviceName(string);
[JScript]
public function get DeviceName() : string;
public function set DeviceName(string);

Property Value

Set to the device name of the printer queue to be monitored. You can find out this name from the Printers section of the windows control panel

Remarks

When this property is set to a valid device name, the PrinterMonitorComponent control starts monitoring that printer

Example

[Visual Basic, C#] The following example creates a PrinterMonitorComponent control to monitor a printer named "HP LaserJet 4". This example uses the MonitorJobWrittenEvent, MonitorJobSetEvent, and ThreadTimeout properties to exclude the events we are not interested in and increase the thread polling frequency to reduce the load on the system.

[Visual Basic] 
Private Sub CreateMyMultilinePrinterMonitorComponent()
    ' Create an instance of a PrinterMonitorComponent control.
    Dim PrinterMonitorComponent1 As New PrinterMonitorComponent()
    
    ' Ignore JobSet and JobWritten Events
    PrinterMonitorComponent1.MonitorJobWrittenEvent = False
    PrinterMonitorComponent1.MonitorJobSetEvent = False

    ' Set the thread polling to half a second
    PrinterMonitorComponent1.ThreadTimout = 500

    ' Start monitoring the HP Laserjet 4 printer
    PrinterMonitorComponent1.DeviceName = "HP Laserjet 4"

End Sub


[C#] 
private void CreateMyMultilinePrinterMonitorComponent()
 {
    // Create an instance of a PrinterMonitorComponent control.
    PrinterMonitorComponent PrinterMonitorComponent1 = new PrinterMonitorComponent();
    
    //Ignore JobSet and JobWritten Events
    PrinterMonitorComponent1.MonitorJobWrittenEvent = false;
    PrinterMonitorComponent1.MonitorJobSetEvent = false;

    // Set the thread polling to half a second
    PrinterMonitorComponent1.ThreadTimout = 500;

    // Start monitoring the HP Laserjet 4 printer
    PrinterMonitorComponent1.DeviceName = "HP Laserjet 4";

 }

[JScript C++] No example is available for JSCript or C++. To view a Visual Basic or C#, example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

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

See Also


© 2003 Merrion Computing Ltd. All rights reserved.