FindNextPrinterChangeNotification - Invalid Handle

G

George

Hi all. I need help 'cause I don't know whatelse more can I check.

I'm facing a really strange problem. I'm monitoring some printers, local
and remote ones. The application consist on a main thread that displays a
window and a second one that handles the monitoring. It is based on the
Print Monitor that comes with MSDN.

Here it goes the strange behaviour. When working with local printers
there is no problem. However when working with the remote ones,
FindNextPrinterChangeNotification returns FALSE and the error is
INVALID_HANDLE (0x06). I don't know what the reason for that strange
behaviour.

Is it due to a misconfiguration of the printer or is any other thing?

I get notification from the remote printers in periodic fashion. Don't
know why. When check the FindNextPrinterChangeNotification it always
return INVALID_HANDLE and there is no data on the *ppPrinterNotifyInfo
field.

Please.. help me out...

TA.
 
K

kooth

I assume you have called FindFirstPrinterChangeNotification first,
followed by a Wait-type function. When you get the INVALID_HANDLE from
FindNextPrinterChangeNotification, it means that the handle upon which
you are waiting is invalid. I would help to post a code snippet. I am
using these functions now and might be able to help.
 
G

George

Nice to see someone answering ;)

psPrinter->hNotification = FindFirstPrinterChangeNotification(
psPrinter->hPrinter,
PRINTER_CHANGE_DELETE_JOB,
0,
&sNotificationOptions);

Then of course I put it under a Wait Function and just after this I get the
notification handler:

if (!FindNextPrinterChangeNotification(hNotification,
&dwChangeNotification,
&sNotificationOptions,
(LPVOID*)&psNotificationInfo) ) {
int iError = GetLastError();
printf("FindNextPrinterChangeNotification %d - %02X\n", iError,
iError);
}


However I know the code is working well as I have tested it. The problem
arise when monitoring some remote printers (not all). It seems that the
printers that fail don't send the notification properly. Indeed, they send
periodic notifications (as I said) of type CHANGE_DELETE_JOB) even when
there is no job in the queue. Strange isn't it?

The problem appear on a brand new install Win2k system. Using a remote
printer that shared this desktop, produces the crash. I don't know why.

TA.
 
K

kooth

Win2k has lots of problems with printing. The Microsoft site
recommends, as always, to install the latest patch (SP4). That might
help. I'll keep digging around, as I need to learn more about this
anyway! Talk to you in a little while.

Kooth
 
Joined
Oct 4, 2010
Messages
1
Reaction score
0
Hello George, have you found any solution to this problem ? i'm facing it and i can't find a solution. Thanks in advance for any information :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top