PrinterQueueWatch ----------------------------------------------------------------------------- Specifies the level of trace information output by the PrinterMonitorComponent You can alter the trace switch by adding the switch to the application.exe.config [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Set to configure how much information is returned with a print job event Typically this should be set to MaximumJobInformation except in cases of very low bandwidth networks [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Raised when a job is added to one of the print spool queues being monitored ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Raised when a job is removed from one of the print spool queues being monitored ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Raised when a job is written to on one of the print spool queues being monitored This event is fired when an application writes to the spool file or when a spool file writes to the print device ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Raised when a job's properties are changed in one of the print spool queues being monitored Be careful altering the print job in response to this event as you might get an endless loop ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Raised when the properties of a printer being monitored are changed ----------------------------------------------------------------------------- True if the component is monitoring any printers ----------------------------------------------------------------------------- Set to the name of the printer to monitor This property is for backward compatibility with the component versions which did not support monitoring multiple printers. Replaced by AddPrinter Thrown when the printer does not exist or the user has no access rights to monitor it [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Retruns the print job collection of the printer being monitored If more that one printer is being monitored this will return the print jobs of the first one added. Use the overloaded version to get the named print device's print jobs [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Retruns the print job collection of the named printer being monitored The name of the printer being monitored that you want to retrieve the print jobs for [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns the printer settings for the printer being monitored If more that one printer is being monitored this will return the details of the first one added. Use the overloaded version to get the named print device settings [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns the printer settings for the named printer being monitored The name of the print device to return the information for [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Adds the printer to the internal list and starts monitoring it The name of the printer to monitor. This can be a UNC name or the name of a printer share Thrown when the printer does not exist or the user has no access rights to monitor it [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Removes a printer from the internal list, stopping monitoring as appropriate The name of the printer to remove and stop monitoring [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Disconnects from all printers being monitored You should disconnect from all the printers being monitored before exiting your application to ensure all the resources are released cleanly [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- Additional buffer to add to a JOB_INFO_1 structure This is required when the buffer first asked for is no longer big enough if the string components change between the first and second call Additional buffer to add to a JOB_INFO_2 structure This is required when the buffer first asked for is no longer big enough if the string components change between the first and second call ----------------------------------------------------------------------------- Set to make the component monitor jobs being added to the job queue True to make the component raise a JobAdded event when a job is added to a printer being monitored Selecting only the notifications you want to be informed about can improve performance in low network bandwidth situations [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Set to make the component monitor jobs being removed from the job queue True to make the component raise a JobDeleted event when a job is added to a printer being monitored Selecting only the notifications you want to be informed about can improve performance in low network bandwidth situations [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Set to make the component monitor jobs being written on the job queue True to make the component raise a JobWritten event when a job is written to on a printer being monitored [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Set to make the component monitor changes to the jobs on the job queue True to make the component raise a JobSet event when a job is altered on a printer being monitored [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Set to make the component monitor printer setup change events True to make the component raise a PrinterInformationChanged event when a printer being monitored has its settings changed [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Set to fine tune the job information required for networks [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Set to tune the printer watch refresh interval This property is obsolete and only included for backward compatibility. It has no effect on the operation of the component [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterMonitorComponent ----------------------------------------------------------------------------- Top level component to allow plug-in monitoring of the windows print spool for one or more printers [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- Returns true if the printer notification message was complete A printer was added to the server being monitored A printer was removed from the server being monitored The settings of a printer on the server being monitored were changed A printer connection error occured on the server being monitored A new printer port was added to the server being monitored The settings for one of the ports on the server being monitored changed A port was removed from the server being monitored A from was added to the server being monitored A form was removed from the server being monitored The properties of a form on the server being monitored were changed A print processor was added to the server being monitored A print processor was removed from the printer being monitored A new printer driver was added to the printer being monitored A printer driver was uninstalled from the server being monitored The settings for a printer driver installed on the server being monitored were changed A type safe collection of PrinterInformation objects representing the printers being monitored by any given PrinterMonitorComponent Unique key is Printer.DeviceName ----------------------------------------------------------------------------- The name of the print provider e.g. "Windows NT Local provider" (for local printers), "Windows NT Remote provider" (for network printers) etc. [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The description of the print provider e.g. "Windows NT Local Printers" etc. [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The comment text (if any) associated with this provider [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- The print domains serviced by this print provider [Duncan] 21/11/2005 Created Project : PrinterQueueWatch Class : PrintProvidor Class representing the properties of a print provider on this domain Lists all the printer providors visible from this process Me.ListBox1.Items.Clear() For ps As Integer = 0 To server.PrintProvidors.Count - 1 Me.ListBox1.Items.Add( server.PrintProvidors(ps).Name ) Next [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- Creates a collection of all the print providors accessible from this machine [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintProvidorCollection ----------------------------------------------------------------------------- The collection of print providors accessible from this machine Lists all the printer providors visible from this process Dim server As New PrintServer Me.ListBox1.Items.Clear() For ps As Integer = 0 To server.Providors.Count - 1 Me.ListBox1.Items.Add( server.Providors(ps).Name ) Next [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- A buffer to add when allocating space for a JOB_INFO_1 structure This is required when the buffer first asked for is no longer big enough if the string components change between the first and A buffer to add when allocating space for a JOB_INFO_2 structure This is required when the buffer first asked for is no longer big enough if the string components change between the first and Returns True if there are any printer or print job events queued that should be processed ----------------------------------------------------------------------------- The name of the server on which this printer is installed This value may be blank if the printer is attached to the current machine Prints the name of the server that the named printer is installed on Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.ServerName) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The unique name by which the printer is known [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- identifies the sharepoint for the printer This will only be set if the Shared property is set to True Prints the name of the share (if any) that the named printer is shared out on Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.ShareName) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the port the printer is connected to Prints the name of the port that the named printer is installed on Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.PortName) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the printer driver software used by this printer Prints the name of the driver that the named printer is using Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.DriverName) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The administrator defined comment for this printer This can be useful for giving extra information about a printer to the user Changes the comment assigned for this printer Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) pi.Comment = "Monitored by PUMA" [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The administrator defined location for this printer Prints the location that the named printer is installed on Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.Location) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the file (if any) that is printed to seperate print jobs on this printer Prints the name of the print job seperator that the named printer using Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.SeperatorFilename) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the print processor associated to this printer Prints the name of the print processor that the named printer using Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.PrintProcessor) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The default spool data type (e.g. RAW, EMF etc.) used by this printer If this value is set to RAW the printer will spool data in a printer control language (such as PCL or PostScript) Prints the name of the default data type that the named printer using Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.DefaultDataType) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Additional parameter used when printing on this printer The possible values and meanings of these extra parameters depend on the printer driver being used Prints the extra parameters (if any) that the named printer using Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.Parameters) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if this printer is the default printer on this machine [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if this printer is a shared device [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if this is a network printer [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if this printer is local to this machine [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The default priority of print jobs sent to this printer Priority can range from 1 (lowest) to 99 (highest). Attempting to set the value outside the range will be reset to the nearest range bounds [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is ready to print The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is stalled because a door or papaer tray is open The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer has an error The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is initialising The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is stalled awaiting a manual paper feed The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is stalled because it is out of toner or ink The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- True if the printer is stalled because it is low on toner or ink The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue ----------------------------------------------------------------------------- True if the printer is currently unnavailable The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is offline The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is stalled because it has run out of memory The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is stalled because it's output tray is full The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is stalled because it has a paper jam The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is stalled because it is out of paper The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is paused The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is deleting a job The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is in power saving mode The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is currently printing a job The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is stalled awaiting manual intervention The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the printer is warming up to be ready to print The status is updated when a job is sent to the printer so may not match the true state of the printer if there are no jobs in the queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The number of print jobs queued to be printed by this printer [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The average throughput of this printer in pages per month [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The time window within which jobs can be scheduled against this printer [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- The default tray used by this printer This value can be overriden for each individual print job [Duncan] 11/02/2006 Created ----------------------------------------------------------------------------- The number of copies of each print job to produce This value can be overridden for each print job [Duncan] 11/02/2006 Created ----------------------------------------------------------------------------- True if the printer orientation is set to Landscape This value can be overriden by the individual print job's orientation True if a colour printer is set to print in colour, false for monochrome Specifies whether collation should be used when printing multiple copies. Not all printers support collation. Those that don't will ignore this setting The scale (percentage) to print the page at ----------------------------------------------------------------------------- [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Pauses the printer Pauses the named printer Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, False) pi.PausePrinting [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Restart a printer that has been paused Resumes printing on the named printing Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) pi.ResumePrinting [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The collection of PrintJobs queued for printing on this printer Prints the name of the documents in the print queue Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) For Each pj As PrintJob In pi.PrintJobs Trace.WriteLine(pj.Document) Next pj [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Sets whether or not events occuring on this printer are raised by the component [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- If true and the printer is being monitored, all print jobs are paused as they are added to the spool queue This is useful for print quota type applications as the print job is immediately paused allowing the quota program to decide whether or not to delete or resume it [Duncan] 07/01/2006 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns information about the printer driver used by a given printer Prints the name of the printer driver Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) Trace.WriteLine(pi.PrinterDriver.Name) [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns the collection of print forms installed on the printer List the print forms on the named printer Dim pi As New PrinterInformation("HP Laserjet 5L", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, False) For pf As Integer = 0 To pi.PrinterForms.Count - 1 Me.ListBox1.Items.Add( pi.PrinterForms(pf).Name ) Next [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- Is the printer for 24-hour availability. [solidcrip] 13/11/2006 Created Configures the printer for limited availability. If you send a document to a printer when it is unavailable, the document will be held (spooled) until the printer is available. [solidcrip] 13/11/2006 Created Specifies that documents should be spooled before being printed. Spooling is the process of first storing the document on the hard disk and then sending the document to the print device. You can continue working with your program as soon as the document is stored on the disk. The spooler sends the document to the print device in the background. [solidcrip] 13/11/2006 Created Specifies that the print device should wait to begin printing until after the last page of the document is spooled. The printing program is unavailable until the document has finished spooling. However, using this option ensures that the whole document is available to the print device. [solidcrip] 13/11/2006 Created Directs the spooler to check the printer setup and match it to the document setup before sending the document to the print device. If the information does not match, the document is held in the queue. A mismatched document in the queue will not prevent correctly matched documents from printing. [solidcrip] 13/11/2006 Created Specifies that the spooler should favor documents that have completed spooling when deciding which document to print next, even if the completed documents are a lower priority than documents that are still spooling. If there are no documents that have completed spooling, the spooler will favor larger spooling documents over smaller ones. Use this option if you want to maximize printer efficiency. When this option is disabled, the spooler picks documents based only on priority. [solidcrip] 13/11/2006 Created Specifies that the spooler should not delete documents after they are printed. This allows a document to be resubmitted to the printer from the printer queue instead of from the program. [solidcrip] 13/11/2006 Created Specifies whether the advanced printing feature is enabled. When enabled, metafile spooling is turned on and options such as Page Order, Booklet Printing, and Pages Per Sheet are available, depending on your printer. For normal printing, leave the advanced printing feature set to the default (Enabled). If compatibility problems occur, you can disable the feature. When disabled, metafile spooling is turned off and the printing options might be unavailable. [solidcrip] 13/11/2006 Created ----------------------------------------------------------------------------- Creates a new printer information class for the named printer The name of the print device The required access rights for that printer True to return the collection of print jobs queued against this print device [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a new printer information class for the named printer The name of the print device The required access rights for that printer True to return the collection of print jobs queued against this print device [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a new printer information class for the named printer The name of the print device The required access rights for that printer No longer used [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterInformation ----------------------------------------------------------------------------- Class which holds the settings for a printer These settings can apply to physical printers and also to virtual print devices [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a collection of printer information for the current machine [Duncan] 20/11/2005 Created [Duncan] 23/02/2008 Changed to use PRINTER_INFO_1 structure ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a collection of printer information objects for the named machine The name of the server to list the printer devices [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterInformationCollection ----------------------------------------------------------------------------- A collection of printer information classes [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- When the spooler notifies the monitoring thread that there is a printer change event signalled, this sub decodes that change event and posts it on the event queue The PrinterInformation class that represents the settings of the printer for which the event was triggered This holds the printer information as it was when the event occured ----------------------------------------------------------------------------- The date and time at which this printer information changed event was triggered ----------------------------------------------------------------------------- The PrinterInfoChangeFlagDecoder class that holds details of what printer settings changed to trigger this printer change event ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterEventArgs ----------------------------------------------------------------------------- Class representing the event arguments used in the change events relating to the printer .. This is passed as an argument in the PrinterInformationChanged event of the PrinterMonitorComponent Prints the user name of a printer if an error occurs Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_PrinterInformationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.PrinterInformationChanged With CType(e, PrinterEventArgs) If .PrinterInformation.IsInError Then Trace.WriteLine(.PrinterInformation.PrinterName) End If End With End Sub True if the number of jobs on the print queue changed The new value will be held in the JobCount member of the PrinterInformation passed with the event ----------------------------------------------------------------------------- True if the printer status has changed The new value will be held in the status fields of the PrinterInformation passed with the event ----------------------------------------------------------------------------- The printer attributes have changed The new value will be held in the attributes fields of the PrinterInformation passed with the event ----------------------------------------------------------------------------- The comment text associated with this printer has been changed The new value will be held in the Comment member of the PrinterInformation passed with the event [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The default device mode settings of the printer have changed The new value will be held in the default device mode related fields of the PrinterInformation passed with the event [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The printer location text has been changed The new value will be held in the Location member of the PrinterInformation passed with the event [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The discretionary access control settings for the printer has changed [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The file used as a job seperator was changed The new value will be held in the SeperatorFilename member of the PrinterInformation passed with the event. [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Unknown change - insufficient change information was provided by the printer This will be true if the printer driver does not issue details of why a printer change event occurs [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterInfoChangeFlagDecoder ----------------------------------------------------------------------------- This class holds details of what printer settings changed to trigger this printer change event A single printer change event may have more than one cause ----------------------------------------------------------------------------- Installs a printer driver on the named server The server to install the driver on The operating system version that the driver targets The name of the driver The environment for which the driver was written (for example, "Windows NT x86", "Windows NT R4000", "Windows NT Alpha_AXP", or "Windows 4.0") The driver program file The file which contains the driver data file name or a full path and file name for the device-driver's configuration .dll Before an application calls the AddPrinterDriver function, all files required by the driver must be copied to the system's printer-driver directory. [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns the directory on the current machine in which the printer drivers and their support files are kept [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns the directory on the named machine in which the printer drivers and their support files are kept The name of the machine to get the directory for [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns the directory on the named machine in which the printer drivers and their support files are kept for the named environment The name of the machine to get the directory for The environment for which the driver was written (for example, "Windows NT x86", "Windows NT R4000", "Windows NT Alpha_AXP", or "Windows 4.0") [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The operating system for which this driver was written ----------------------------------------------------------------------------- The unique name by which this printer driver is known [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The environment for which the driver was written For example, "Windows NT x86", "Windows NT R4000", "Windows NT Alpha_AXP", or "Windows 4.0" The file name or full path and file name for the file that contains the device driver " For example, "c:\drivers\pscript.dll" This value will be relative to the server The file name or a full path and file name for the file that contains driver data For example, "c:\drivers\Qms810.ppd" The file name or a full path and file name for the device-driver's configuration .dll These configuration files provide the user interface for the extra The file name or a full path and file name for the device driver's help file. This member may be blank if the driver has no help file The name of a language monitor attached to this driver (for example, "PJL monitor") This member can be empty and is specified only for printers capable of bidirectional communication The default data type used by this printer driver in writing spool files for print jobs This can be EMF or RAW. The latter indicates that a printer control language (such as PCL or PostScript) is used. ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterDriver ----------------------------------------------------------------------------- Specifies the settings for a printer driver Lists all the printer drivers on the current server Dim server As New PrintServer Dim Driver As PrinterDriver Me.ListBox1.Items.Clear() For Each Driver In server.PrinterDrivers Me.ListBox1.Items.Add(Driver.Name) Next The Item property returns a single printer driver from this collection. ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterDriverCollection ----------------------------------------------------------------------------- The collection of printer drivers on a server Lists all the printer drivers on the current server Dim server As New PrintServer Dim Driver As PrinterDriver Me.ListBox1.Items.Clear() For Each Driver In server.PrinterDrivers Me.ListBox1.Items.Add(Driver.Name) Next ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterMonitoringExceptions.InsufficentPrinterAccessRightsException ----------------------------------------------------------------------------- Thrown when an attempt is made to access the printer by a process that does not have sufficient access rights [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterMonitoringExceptions.InsufficentPrintJobAccessRightsException ----------------------------------------------------------------------------- Thrown when an attempt is made to access the print job by a process that does not have sufficient access rights [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The print job for which this event occured [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The date and time at which the print job event occured [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The type of job event that occured [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Frees up any system resources used by this job event notification [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintJobEventArgs ----------------------------------------------------------------------------- Class wrapper for the event arguments used in the change events relating to individual jobs in a printer queue.. Prints the user name of a job when it is added Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine( .PrintJob.Username ) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- The name of the server on which this port resides The name supported printer port (for example, "LPT1:"). ----------------------------------------------------------------------------- Identifies an installed monitor (for example, "PJL monitor"). This may be empty if no port monitor associated with this port More detailed description of this printer port The port supports read functionality The port supports write operation True if the port is redirected True if the port is network attached ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : Port ----------------------------------------------------------------------------- Represents information about the port to which a printer is attached Lists all the ports on the current print server Dim server As New PrintServer ListBox1.Items.Clear() For ps As Integer = 0 To server.Ports.Count - 1 Me.ListBox1.Items.Add(server.Ports(ps).Name) Next ----------------------------------------------------------------------------- Returns the ports on the current machine To get the ports of another machine use the overloaded constructor and pass the server name as a reference [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Enumerates the ports on the named server The server to list the ports on The server does not exist of the user does not have access to it [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PortCollection ----------------------------------------------------------------------------- A collection of Port objects Lists all the ports on the current printer Dim server As New PrintServer ListBox1.Items.Clear() For ps As Integer = 0 To server.Ports.Count - 1 Me.ListBox1.Items.Add(server.Ports(ps).Name) Next [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the print server [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The server name on which the print processor is installed [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The collection of data types that this print processor can process [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the server that this processor is installed on The name of this print processor [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintProcessor ----------------------------------------------------------------------------- Class wrapper for the properties relating to the printer processors .. Dim server As New PrintServer Dim Processor As PrintProcessor Me.ListBox1.Items.Clear() For ps As Integer = 0 To server.PrintProcessors.Count - 1 Me.ListBox1.Items.Add( server.PrintProcessors(ps).Name ) Next [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a collection of print processors installed on the current print server [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a collection of print processors installed on the named print server The name of the print server to return the print processors for [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintProcessorCollection ----------------------------------------------------------------------------- The collection of print processors installed on a print server Dim server As New PrintServer Me.ListBox1.Items.Clear() For ps As Integer = 0 To server.PrintProcessors.Count - 1 Me.ListBox1.Items.Add( server.PrintProcessors(ps).Name ) Next [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the data type of the spool file If this value is RAW then the spool file contains a printer control language (such as PostScript, PCL-5, PCL-XL etc.) [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : DataType ----------------------------------------------------------------------------- The data type of a spool file This is the data type that the spool file contains. It can be EMF or RAW. Lists all the data types supported by each of the print processors installed on the current server Dim server As New PrintServer Dim Processor As PrintProcessor Me.ListBox1.Items.Clear() For ps As Integer = 0 To server.PrintProcessors.Count - 1 ListBox1.Items.Add( server.PrintProcessors(ps).Name ) For dt As Integer = 0 to server.PrintProcessors(ps).DataTypes.Count - 1 Me.ListBox1.Items.Add(server.PrintProcessors(ps).DataTypes(dt).Name) Next Next [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- Returns a single data type from the collection The zero-based position in the collection Removes the data type from this collection ----------------------------------------------------------------------------- Creates a new collection containing all the data types supported by the named print processor The name of the print processor to retrieve the supported data types for The print processor must be installed on the local machine Prints the name of all the data types supported by the print processor named WinPrint Dim DataTypes As New DataTypeCollection("Winprint") For Each dt As DataType In DataTypes Trace.WriteLine(dt.Name) Next dt [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- Creates a new collection containing all the data types supported by the named print processor on the named server The server on which the print processor resides The print processor name Prints the name of all the data types supported by the print processor named WinPrint Dim DataTypes As New DataTypeCollection("DUBPDOM1","Winprint") For Each dt As DataType In DataTypes Trace.WriteLine(dt.Name) Next dt ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : DataTypeCollection ----------------------------------------------------------------------------- The collection of data types supported by a print processor [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- Returns the cached ResourceManager instance used by this class. Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class. Looks up a localized string similar to Error. Looks up a localized string similar to Offline. Looks up a localized string similar to Out of Paper. Looks up a localized string similar to Paused. Looks up a localized string similar to Printed. Looks up a localized string similar to Printing. Looks up a localized string similar to Configuration File. Looks up a localized string similar to Data File. Looks up a localized string similar to Default Data Type. Looks up a localized string similar to Driver DLL. Looks up a localized string similar to Environment. Looks up a localized string similar to Help File. Looks up a localized string similar to Monitor Name. Looks up a localized string similar to Name. Looks up a localized string similar to Operating System Version. Looks up a localized string similar to Print job redirection failed. Looks up a localized string similar to Insufficient print job access rights. Looks up a localized string similar to Insufficient rights to pause printing. Looks up a localized string similar to Insufficient access rights. Looks up a localized string similar to Insufficient rights to resume printing. Looks up a localized string similar to Average Pages Per Month. Looks up a localized string similar to Comment. Looks up a localized string similar to Default Print Job Data Type. Looks up a localized string similar to Driver Name. Looks up a localized string similar to Default. Looks up a localized string similar to Network Printer. Looks up a localized string similar to Shared. Looks up a localized string similar to Count of Queued Jobs. Looks up a localized string similar to Location. Looks up a localized string similar to Not Default. Looks up a localized string similar to Local Printer. Looks up a localized string similar to Not Shared. Looks up a localized string similar to Parameters. Looks up a localized string similar to Port. Looks up a localized string similar to Printer Name. Looks up a localized string similar to Print Processor. Looks up a localized string similar to Default Print Job Priority. Looks up a localized string similar to Job Seperator Filename. Looks up a localized string similar to Server Name. Looks up a localized string similar to Shared As. Looks up a localized string similar to Time Restriction. Looks up a localized string similar to Copies. Looks up a localized string similar to Data Type. Looks up a localized string similar to Document. Looks up a localized string similar to Printer Driver. Looks up a localized string similar to Color. Looks up a localized string similar to Landscape. Looks up a localized string similar to Job Size (in Bytes). Looks up a localized string similar to Machine. Looks up a localized string similar to Black and White. Looks up a localized string similar to Potrait. Looks up a localized string similar to Notify User. Looks up a localized string similar to Pages Printed. Looks up a localized string similar to Paper Type. Looks up a localized string similar to Page Length. Looks up a localized string similar to Paper Source. Looks up a localized string similar to Page Width. Looks up a localized string similar to Parameters. Looks up a localized string similar to Position in Queue. Looks up a localized string similar to Printer. Looks up a localized string similar to Resolution. Looks up a localized string similar to Horizontal Resolution. Looks up a localized string similar to Vertical Resolution. Looks up a localized string similar to Print Processor. Looks up a localized string similar to Priority. Looks up a localized string similar to Time in Queue. Looks up a localized string similar to Status. Looks up a localized string similar to Submitted. Looks up a localized string similar to Print Time Restriction. Looks up a localized string similar to Total Pages. Looks up a localized string similar to User. Looks up a localized string similar to Cannot cancel print job. Looks up a localized string similar to Cannot delete print job. Looks up a localized string similar to Cannot update print job. Looks up a localized string similar to From. Looks up a localized string similar to Unrestricted. Looks up a localized string similar to Until. A strongly-typed resource class, for looking up localized strings, etc. ----------------------------------------------------------------------------- The name of the printer form [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The width of the form This value is measured in millimeters [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The height of the printer form This value is measured in millimeters [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Specifies the width and height, in thousandths of millimeters, of the form. This may be smaller than the height and width if there is a non-printable margin on the form [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterForm ----------------------------------------------------------------------------- Represents a form that has been installed on a printer List the print forms on the named printer Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) For pf As Integer = 0 to pi.PrinterForms.Count -1 pi.PrinterForms(pf).Name Next [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterFormCollection ----------------------------------------------------------------------------- A collection of PrintForm objects supported by a printer List the print forms on the named printer Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) For pf As Integer = 0 To In pi.PrinterForms.Count - 1 Me.ListBox1.Items.Add( pi.PrinterForms(pf).Name ) Next [Duncan] 19/11/2005 Created ----------------------------------------------------------------------------- The name of the print domain [Duncan] 17/02/2006 Created ----------------------------------------------------------------------------- The description of the print domain The comment associated with this print domain ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintDomain ----------------------------------------------------------------------------- Lists all the print domains on all the printer providors visible from this process Dim Providors As New PrintProvidorCollection Me.ListBox1.Items.Clear() For ps As Integer = 0 To Providors.Count - 1 Me.ListBox1.Items.Add( Providors(ps).Name ) For ds As Integer = 0 To Providors(ps).PrintDomains.Count - 1 Me.ListBox1.Items.Add( Providors(ps).PrintDomains(ds).Name ) Next Next The Item property returns a single print domain from a print domain collection. The zero-based item position Removes a print domain from this collection ----------------------------------------------------------------------------- Creates a list of all the print domains visible from this machine for the named providor The name of the PrintProvidor to get the list of print domains for ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintDomainCollection ----------------------------------------------------------------------------- A collection of PrintDomain objects for a given print providor Lists all the print domains on all the printer providors visible from this process Dim Providors As New PrintProvidorCollection Me.ListBox1.Items.Clear() For ps As Integer = 0 To Providors.Count - 1 Me.ListBox1.Items.Add( Providors(ps).Name ) For ds As Integer = 0 To Providors(ps).PrintDomains.Count - 1 Me.ListBox1.Items.Add( Providors(ps).PrintDomains(ds).Name ) Next Next ----------------------------------------------------------------------------- Print Job specific tracing switch Add a trace flag named "PrintJob" in the application .config file to trace print job related processes [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The unique identifier of the print job This id is only unique for the printer [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the print device that this job is queued against Prints the name of the printer whenever a new job is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.PrinterName) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the user that sent the print job for printing Prints the name of the user that originated the job whenever a new job is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.Username) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the workstation that sent the print job to print Prints the name of the machine that originated a job whenever a new job is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.MachineName) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The document name being printed This value is set by the application which sends the job to be printed. Many applications put the application name at the start of the document name to aid identification Prints the name of the documents in the print queue Dim pi As New PrinterInformation("Microsoft Office Document Image Writer", SpoolerApiConstantEnumerations.PrinterAccessRights.PRINTER_ALL_ACCESS, True) For Each pj As PrintJob In pi.PrintJobs Trace.WriteLine(pj.Document) Next pj [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The description of the current status of the print job Prints the status of a job when it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.StatusDescription) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the data type that is used for this print job This can be RAW or EMF. if the data type is RAW then the spool file contains a printer control language such as PCL or PostScript Prints the data type of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.DataType) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The number of pages that have been printed Prints the number of pages in each job as it is deleted Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobDeleted(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobDeleted With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.PagesPrinted.ToString) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The position of the job in the print device job queue Prints the position in the queue of each new job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.Position.ToString) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Get the latest state of the print job from the print device spool queue [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Update the print spool with changes made to this print job class Changes the user name for each new job as it is added to the monitored printers and commits this to the print queue Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) .PrintJob.Username = "New user name" .PrintJob.Commit End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The total number of pages in this print job Prints the number of pages in each new job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.TotalPages.ToString) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The paper type that the job is intended to be printed on This could be a standard paper size (A4, A5 etc) or custom paper size if the printer supports this Prints the paper type of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.PaperKind.ToString) End With End Sub [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The width of the selected paper (if PaperKind is PaperKind.Custom) This value is measured in millimeters Prints the paper width of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.PaperWidth.ToString) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The height of the selected paper (if PaperKind is PaperKind.Custom) This value is measured in millimeters Prints the paper length of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.PaperLength.ToString) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the print job is to be printed in landscape mode Prints the landacape mode of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(IIf(.PrintJob.Landsape,"Landscape", "Portrait")) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the print job is to be printed in colour This will be true if the setting is set to rpint in colour even if the actual document has no colour elements Prints the colour / monochrome setting of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(Iif(.PrintJob.Color,"Colour", "Monochrome")) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The input source (tray or bin) requested for the print job Prints the paper source of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.PaperSource.ToString) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The resolution to use for the print document Can be draft, low, medium or high quality or custom quality Prints the print resolution of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.PrinterResolutionKind) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The printer resolution in the horizontal dimension This value is set if PrinterResolutionKind is PrinterResolutionKind.Custom This is measured in dots per inch [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The printer resolution in the vertical dimension This valuse is set if PrinterResolutionKind is PrinterResolutionKind.Custom. This is measured in dots per inch [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The number of copies of each page to print Some applications misreport the number of copies to the spooler which will result in incorrect values being returned Prints the number of copies of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.Copies.ToString) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The user to notify about the progress of this print job This should be set to the network login name of the user Changes the notify user of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) .PrintJob.NotifyUserName = "Administrator" .PrintJob.Commit End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the print processor which is responsible for printing this job [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the printer driver that is responsible for producing this print job [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The priority of this print job. Higher priority jobs will be processed ahead of lower priority jobs Valid values are in the range of 1 (lowest priority) to 99 (highest priority) Prints the priority of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.Priority.ToString) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Extra driver specific parameters for this print job The acceptable parameters and values depend on the print driver being used to print this print job [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Specifies the date and time at which the job was submitted for printing The time value is returned in the local time of the machine on which the PrintQueueWatch component is installed Prints the date and time submitted of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.Submitted.ToString) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Specifies the earliest time and latest times that the job can be printed See the TimeWindow class for details of the settings of this class [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Specifies the total time, in milliseconds, that has elapsed since the job began printing [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Specifies the size, in bytes, of the job While the job is being spooled this will contain the current size of the spool file Prints the job size of each job as it is added to the monitored printers Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine(.PrintJob.DataType) End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The number of logical pages for each physical page This value should be 1, 2, 4, 8 or 16 [Duncan] 11/02/2006 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The paper tray (or input bin) to use for this print job [Duncan] 11/02/2006 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Cancels this print job and removes it from the spool queue Only the originator of a print job or a user with administrator rights on the print device may cancel the job Thrown if the user has no access rights to delete this job Cancels any jobs that have more than 8 copies Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs).PrintJob If .Copies > 8 Then .Cancel End If End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Deletes this print job Only the originator of a print job or a user with administrator rights on the print device may delete it Thrown if the user has no access rights to delete this job Cancels any jobs that have more than 8 copies Private WithEvents pmon As New PrinterMonitorComponent pmon.AddPrinter("Microsoft Office Document Image Writer") pmon.AddPrinter("HP Laserjet 5") Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As System.EventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs).PrintJob If .Copies > 8 Then .Delete End If End With End Sub [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Whether the print job is paused Thrown if the job does not exist or the user has no access rights to pause it [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the print job has been deleted [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the print job is being deleted [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the job has been printed This will be true once the job has been completely sent to the printer. This does not mean that the physical print out has necessarily appeared. [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the print job is currently printing [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if there is an error with this print job that prevents it from printing [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the job is in error because the printer is off line [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the job is in error because the printer has run out of paper [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the print job is in error because the printer requires user intervention This can be caused by a print job that requires manual paper feed [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the print job is spooling to a spool file [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Transfers this print job to the named printer Name of the new printer to move the job to True to remove this copy of the job If the DataType is RAW then the target printer may not print the job if it does not support the printer control language that the job contains [Duncan] 05/12/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns the job identified by JobId queued against the device named The name of the device the job is queued against The unique job identifier [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Frees up system resources used by this PrintJob class [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns the unique name of this job which can be passed to get a handle to it [PrinterNmae], PrintJob xxxxx Used internally for ReadPrinter api call [Duncan] 05/12/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintJob ----------------------------------------------------------------------------- Represents the properties of a single print job queued against a print device [Duncan] 20/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Gets the print job by its unique Job Id [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns true if this collection contains the given Job Id [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a new empty PrintJobs collection This constructor is not meant for use except by the PrinterQueueWatch component [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a new list and fills it with all the jobs currently on a given printer's queue by printer handle The handle of the printer to get the print jobs for The number of jobs to retrieve If JobCount is less than the number of jobs in teh queue only the first JobCount number will be returned [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a new list and fills it with all the jobs currently on a given printer's queue by printer device name The name of the print device to get the jobs for The number of print jobs to return If JobCount is less than the number of jobs in the queue only the first JobCount number will be returned Thrown if the print device does not exist or the user has no access rights to retrieve the job queue from it [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintJobCollection ----------------------------------------------------------------------------- A collection of print jobs [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a new time window with the given range The start of the time range in minutes past midnight GMT The end of the time range in minutes past midnight GMT [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Creates a new time window with the given range The start of the time range in local time The end of the time range in local time [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The time of the start of this time range This value is in the system local time [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The end of the time range This time is in local system time [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- True if the time range is unrestricted If the time range is unrestricted it is from midnight to midnight [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Returns a text description of the tiem range [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : TimeWindow ----------------------------------------------------------------------------- Specifies a time window during which an event can be scheduled - for example when a print job can be printed [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrinterDataFile ----------------------------------------------------------------------------- An in-memory representation of a print spool file This class is for internal use of the PrintQueueWatch component [Duncan] 05/12/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the form used to print the print job [Duncan] 17/02/2006 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The version number of the driver used to print this job [Duncan] 17/02/2006 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : EMF_SpoolFile ----------------------------------------------------------------------------- Helper class for EMF format spool file [Duncan] 12/12/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PCLXLSpoolFile ----------------------------------------------------------------------------- Helper class for PCL XL format spool file [Duncan] 13/12/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The name of the print monitor [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The environment for which the print monitor was created For example, "Windows NT x86", "Windows NT R4000", "Windows NT Alpha_AXP", or "Windows 4.0" [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The dynamic link library that implements this print monitor [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Text description of this print monitor instance [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintMonitor ----------------------------------------------------------------------------- Class wrapper for the windows API calls and constants relating to print monitors Lists teh details of all the print monitors on the current server Dim server As New PrintServer Me.ListBox1.Items.Clear() For ms As Integer = 0 To server.PrintMonitors.Count - 1 Me.ListBox1.Items.Add( server.PrintMonitors(ms).Name ) Next [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Gets a collection of print monitors on the current server [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Gets a collection of print monitors on the named server The name of the server to get the print monitors from [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintMonitors ----------------------------------------------------------------------------- A collection of print monitors on a server Lists the details of all the print monitors on the current server Dim server As New PrintServer Me.ListBox1.Items.Clear() For ms As Integer = 0 To server.PrintMonitors.Count - 1 Me.ListBox1.Items.Add( server.PrintMonitors(ms).Name ) Next [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- The print monitors installed on this print server Lists the print monitors on the current machine in a list box Dim server As New PrintServer Me.ListBox1.Items.Clear() For ms As Integer = 0 To server.PrintMonitors.Count - 1 Me.ListBox1.Items.Add( server.PrintMonitors(ms).Name ) Next [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- The print processors installed on this print server [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The printer drivers installed on this print server [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The print ports installed on this print server [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- The print devices installed on this print server These can be both physical printers and also software print devices [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- The name of the server for which this component returns printer information Set this value to blank to return information about the current server ----------------------------------------------------------------------------- Gets print server information for the named server The server to query information for [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Gets print server information for the current machine [Duncan] 21/11/2005 Created ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Project : PrinterQueueWatch Class : PrintServer ----------------------------------------------------------------------------- Class with properties pertaining to a print server [Duncan] 21/11/2005 Created -----------------------------------------------------------------------------