 |
| Using Change Notification Objects to monitor changes to the printer or print server |
User rating: 0/10 (0 votes) | |
|
|
 |
 |
| Before you begin: |
 |
Set cPrinter variable to the name of a local or network printer. For at least 60 seconds the program will be recording any changes in printer jobs for the printer: jobs added, deleted, suspended etc.
Note that once started, the program gets into a waiting state (appears to stop responding) for at least one minute. This is caused by the WaitForSingleObject call. Every change in a print job resets this one-minute interval. So in case of intensive print traffic the program may stay frozen indefinitely long.
This is a log similar to what this program creates:

As you can see, the log stores a wide set of parameters. It includes the name of the printer, the name of the machine that created the job, the number of pages to be printed and already printed, the size of the job in bytes and more. |
 |
 |
| |
| |
Members area. Log in to view this example. |
|
| |
|
|
|
|
|
 |
User rating: 0/10 (0 votes) | |
| 9004 bytes Created: 2005-04-06 19:47:15 Modified: 2009-02-03 15:26:42 Visits in 7 days: 168 |
|
 |
 |
| Listed functions: |
 |
|
 |
 |
| My comment: |
 |
The Visual FoxPro is a single-thread environment. That means, once you have started to monitor printer jobs, the application is virtually frozen until a change happens or the time-out interval elapses.
On any change, the FindNextPrinterChangeNotification returns a set of PRINTER_NOTIFY_INFO_DATA structures for each and every print job, not just for the job that triggered the change. For example, on adding a job, you have information for this job and all other jobs returned. But on deleting a job you do not have its information returned. |
 |
 |
| Word Index links for this example: |
 |
|
|
 |
 |
| Translate this page: |
 |
|