Article View: borland.public.cppbuilder.nativeapi
Article #4316Re: Printer notification
From: Remy Lebeau (TeamB)
Date: Fri, 10 Feb 2006 20:26
Date: Fri, 10 Feb 2006 20:26
38 lines
2587 bytes
2587 bytes
"Bogdan" <boprea@xnet.ro> wrote in message
news:43ecd5bb@newsgroups.borland.com...
> I cannot make a difference between a job that is deleted before
> printing because the user chose to abort the print operation, and
> the job that is deleted from the spooler because it finished printing.
You have to keep track of the job information. Currently, you are
completely ignoring the pPrinterNotifyOptions and ppPrinterNotifyInfo
parameters of FindNextPrinterChangeNotification(). The ppPrinterNotifyInfo
parameter provides detailed information about each notification. For
example, you can use it to detect JOB_NOTIFY_FIELD_STATUS,
JOB_NOTIFY_FIELD_PAGES_PRINTED, and/or JOB_NOTIFY_FIELD_BYTES_PRINTED
changes. Also, you should be keeping track of the active jobs as well.
When a job is added, add its information to a list somewhere. When the job
is deleted, remove the job from your list. When the job is written to the
printer, keep track of its printing status. When the job is deleted, you
can check the last known status to know what the job was doing.
> while(!Terminated)
> {
> WaitForSingleObject(Notifier,INFINITE);
By doing that, you won't be able to terminate the thread while it is waiting
for a notification. You should use CreateEvent() to create a second event
and then use WaitForMultipleObjects() instead. This way, when the
application wants to shut down the thread, it can signal the event.
> Changes = 0x00000000;
> if(FindNextPrinterChangeNotification(Notifier,&Changes,NULL,NULL))
> {
Where are you calling FindFirstPrinterChangeNotification()? Which
notifications are you asking it for?
Gambit
Technical Details
Message-ID:
<43ecf638$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43ecd5bb@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2eb2d0dc0d96a498 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <43ecd5bb@newsgroups.borland.com> Subject: Re: Printer notification Date: Fri, 10 Feb 2006 12:26:25 -0800 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <43ecf638$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1139603000 68.69.17.41 (10 Feb 2006 12:23:20 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail