FindNextPrinterChangeNotification - Invalid Handle

  • Thread starter Thread starter George
  • Start date Start date
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.
 
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.
 
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.
 
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
 
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 :)
 
Back
Top