Am Dienstag, den 11.10.2005, 10:36 +0200 schrieb Jonathan Ernst:
-- cut -- + + EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num); + if(num == 0) + { + -- cut --
Sorry that didn't work. You receive in "num" the Number of returned PRINTER_INFO_2 Entries in "buffer" Since "buffer" is NULL, "num" is always 0.
Working Example from my Patch: ( http://www.winehq.org/pipermail/wine-patches/2005-October/021268.html )
+ /* Verify, that we have a Printer installed */ + /* this will fail in wine, when you deleted your printer */ + + numentries = 0; + size = 0; + result = pEnumPrintersA(PRINTER_ENUM_LOCAL, + NULL, 2, NULL, 0, &size, &numentries); + + if (size == 0) + { + result = pEnumPrintersA(PRINTER_ENUM_CONNECTIONS, + NULL, 2, NULL, 0, &size, &numentries); + } + -- cut -- size == 0: no Printer installed size > 0: one or more Printers installed