AUTODEFINE "OFF" $include "windowssdk.inc" PRINTER_INFO_2 pi2 INT result,Need,xEnum,I MEMORY pBuf OPENCONSOLE string prtname=GETDEFAULTPRINTER ' If Need = 0, then the API returns the number of bytes needed Need = 0 result = EnumPrintersA(2,"",2,pBuf,Need,Need,xEnum) ' Now allocate a memory buffer for the table to be returned ALLOCMEM pBuf,1,Need result = EnumPrintersA(2,"",2,pBuf,Need,Need,xEnum) ' xEnum contains the number of udt's FOR I = 1 TO xEnum ' copy from table to local udt READMEM pBuf, I, pi2 if prtname=pi2.#pPrinterName CLS PRINT "PRINTER_INFO_2" PRINT PRINT "PrinterName : ", pi2.#pPrinterName PRINT "PortName : ", pi2.#pPortName PRINT "DriverName : ", pi2.#pDriverName PRINT "Attributes : ", pi2.Attributes PRINT PRINT "Status : ", pi2.#Status endif NEXT I FREEMEM pBuf PRINT PRINT "Press any key to end program" DO:UNTIL INKEY$<>"" CLOSECONSOLE