Tester une variable de FindNextPrinterChangeNotification

cs_sena Messages postés 126 Date d'inscription jeudi 9 janvier 2003 Statut Membre Dernière intervention 15 février 2005 - 18 juin 2003 à 10:13
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019 - 18 juin 2003 à 10:23
Bonjour,

j'ai ce petit bout de code :

HANDLE chgObject;
DWORD pdwChange;
BOOL fcnreturn;

chgObject = FindFirstPrinterChangeNotification( hPrinter, PRINTER_CHANGE_JOB, 0, NULL);
WaitForSingleObject(chgObject, INFINITE);
fcnreturn = FindNextPrinterChangeNotification(chgObject, &pdwChange, NULL, NULL);
if (fcnreturn) {
//Ici il faut que je travaille sur pdwchange
}

Dans la msdn en ligne, ils disent :
pdwChange
[out] Pointer to a variable whose bits are set to indicate the changes that occurred to cause the most recent notification. The bit flags that might be set correspond to those specified in the fdwFlags parameter of the FindFirstPrinterChangeNotification call. The system sets one or more of the following bit flags.

Mon problème est que je sais pas comment tester la valeur de pdwchange,
j'ai fait un switch-case mais ce ne fonctionne pas.
Comprends vraiment pas comment faut faire... :o(

Merci
Sena

PS : j'ai bien mis OpenPrinter et ClosePrinter à la bonne place.

1 réponse

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
18 juin 2003 à 10:23
en 1er faudra tester valeur de sortie de WaitForSingleObject.
Ensuite pour pdwChange, exemple:
if((pdwChange & PRINTER_CHANGE_TIMEOUT) == PRINTER_CHANGE_TIMEOUT) case machin truc.
Tu peux combiner les flags, suffit que combination soit coherente.
BruNews, ciao...
0
Rejoignez-nous