🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Printer hook

#4307
From: Remy Lebeau (TeamB)
Date: Wed, 08 Feb 2006 23:43
32 lines
2141 bytes
"Bogdan" <boprea@xnet.ro> wrote in message
news:43ea6f46@newsgroups.borland.com...

> I need to monitor the job queue of a specified printer

Under NT-based systems, you can use FindFirstPrinterChangeNotification(),
FindNextPrinterChangeNotification(), and
FindClosePrinterChangeNotification().

> I can enumerate current jobs, but I think using a timer or a thread
> to periodically check the job queue is not very efficient, because
> most of the time the queue will be empty.

By using a thread, you can call FindFirstPrinterChangeNotification() and
then call WaitForSingleObject() in a loop.  Each time WaitForSingleObject()
indicates that a change has occured, use FindNextPrinterChangeNotification()
to find out you why the change occured.  You can even get printing status.

Refer to MSDN for more details:

    FindFirstPrinterChangeNotification
    http://msdn.microsoft.com/library/en-us/gdi/prntspol_9sxa.asp

    FindNextPrinterChangeNotification
    http://msdn.microsoft.com/library/en-us/gdi/prntspol_0tym.asp

    FindClosePrinterChangeNotification
    http://msdn.microsoft.com/library/en-us/gdi/prntspol_1c1a.asp


Gambit
Technical Details
Message-ID: <43ea8190$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.volia.net!news.germany.com!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!news-raspail.gip.net!news.gsl.net!gip.net!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43ea6f46@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8297d2fbab980836
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: <43ea6f46@newsgroups.borland.com>
Subject: Re: Printer hook
Date: Wed, 8 Feb 2006 15:43:42 -0800
Lines: 34
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: <43ea8190$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1139442064 68.69.17.41 (8 Feb 2006 15:41:04 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.volia.net!news.germany.com!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!news-raspail.gip.net!news.gsl.net!gip.net!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail