🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4319

Re: Printer notification

#4319
From: Bogdan
Date: Sat, 11 Feb 2006 18:09
36 lines
2241 bytes
Thanks for the sample code.It worked, but with some little modifications.
You have to specify in an array which printer job fields you want to
monitor for changes :

WORD Types[4] = {JOB_NOTIFY_FIELD_PAGES_PRINTED,
                                 JOB_NOTIFY_FIELD_STATUS,
                                 JOB_NOTIFY_FIELD_TOTAL_BYTES,
                                 JOB_NOTIFY_FIELD_BYTES_PRINTED};

PRINTER_NOTIFY_OPTIONS_TYPE pnot;
pnot.Type = JOB_NOTIFY_TYPE;
pnot.Count = 4;
pnot.pFields = &Types[0];

PRINTER_NOTIFY_OPTIONS pno;
pno.Version = 2;
pno.Flags = PRINTER_NOTIFY_OPTIONS_REFRESH;
pno.Count = 1;
pno.pTypes = &pnot;

PPRINTER_NOTIFY_INFO pni;

Notifier = 
FindFirstPrinterChangeNotification(printer,PRINTER_CHANGE_JOB,0,&pno);
. . .
if(FindNextPrinterChangeNotification(Notifier,&Changes,&pno,(void**)&pni))
. . .

However, now I have another big problem.Windows sends the job to the 
printer, and reports only
JOB_STATUS_SPOOLING and JOB_STATUS_PRINTING.All of the other errors
(like paper out or printer disconnected) are handled by the printer driver, 
without any notification
to the spooler.

Bogdan 
Technical Details
Message-ID: <43ee2762@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43ecd5bb@newsgroups.borland.com> <43ecf638$1@newsgroups.borland.com> <43ecfc34$1@newsgroups.borland.com> <43ed198a$1@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
Reply-To: "Bogdan" <boprea@xnet.ro>
From: "Bogdan" <boprea@xnet.ro>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43ecd5bb@newsgroups.borland.com> <43ecf638$1@newsgroups.borland.com> <43ecfc34$1@newsgroups.borland.com> <43ed198a$1@newsgroups.borland.com>
Subject: Re: Printer notification
Date: Sat, 11 Feb 2006 20:09:10 +0200
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 85.186.237.190
Message-ID: <43ee2762@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1139681122 85.186.237.190 (11 Feb 2006 10:05:22 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail