Click to See Complete Forum and Search --> : win32 method problem


lebogang
January 11th, 2004, 03:44 AM
can any one help in using a win32 method FindNextPrinterChangeNotification()

the MSDN doc for it sais you must pass a LPVOID* to it to retrieve the print information. this info is stored in a system-allocated, read-only buffer.

But when the function returns this parameter is always null.

Can any one tell me what i could be doing wrong. here is the code i have written.

HANDLE CNHandle;
DWORD pdwChange = 0;//Pointer to conditions that changed
PRINTER_NOTIFY_OPTIONS pnoStruct; //Refresh options
LPPRINTER_NOTIFY_INFO pPrinterNotifyInfo = NULL;//to hold printer information

//getting the notification object handle
CNHandle = FindFirstPrinterChangeNotification(hPrinter, PRINTER_CHANGE_ADD_JOB, 0, NULL)) != INVALID_HANDLE_VALUE)

//waiting for a notification event
WaitForSingleObject(CNHandle , INFINITE);

//extracting print event information
if (FindNextPrinterChangeNotification(CNHandle, &pdwChange, &pnoStruct, (LPVOID*)&pPrinterNotifyInfo) == TRUE)
/*Always return NULL in pPrinterNotifyInfo even if the function does not fail*/
{
return 0;
}

**************************************************
*
thanks in advance





:blush:

Luzhi
January 12th, 2004, 06:00 AM
i had similar problem with RasConnectionNotification (it worked on win xp and AMD Athlon, but it didnt work on win2000 and PII), so i took old compiler (VC6), and that code worked on win2000
so maybe you can try swithching compiler or something.

I know its a long shot, but if you run out of options :)

good luck

lebogang
January 13th, 2004, 02:39 AM
thanks Luzhi but my other problem is that i am using Visual Studio.NET so i cant recompile the code in older compilers. may you may now of a .NET class i can use to accomplish the same thing as in win32

thanks in advance

lebogang
January 15th, 2004, 05:50 AM
Originally posted by Luzhi
i had similar problem with RasConnectionNotification (it worked on win xp and AMD Athlon, but it didnt work on win2000 and PII), so i took old compiler (VC6), and that code worked on win2000
so maybe you can try swithching compiler or something.

I know its a long shot, but if you run out of options :)

good luck

Lebogang:
thanks Luzhi but my other problem is that i am using Visual Studio.NET so i cant recompile the code in older compilers. maybe you may now of a .NET class i can use to accomplish the same thing as in win32

thanks in advance