User Tools

Site Tools


enumerating_20the_20installed_20printers

Enumerating the installed printers

by Richard Russell, February 2014

The following program will list the installed printers:

        SYS "LoadLibrary", "WINSPOOL.DRV" TO winspool%
        SYS "GetProcAddress", winspool%, "EnumPrintersA" TO EnumPrinters%
 
        SYS EnumPrinters%, 6, 0, 4, 0, 0, ^needed%, ^returned%
        DIM buffer% needed%
        SYS EnumPrinters%, 6, 0, 4, buffer%, needed%, ^needed%, ^returned%
        IF returned% = 0 PRINT "No printers" : END
 
        FOR p% = 0 TO returned%-1
          PRINT $$!(buffer% + 12*p%)
        NEXT p%

The names displayed correspond to those which you need to use in the *PRINTER command, so this routine can be useful in avoiding the No such printer error.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
enumerating_20the_20installed_20printers.txt · Last modified: 2024/01/05 00:22 by 127.0.0.1