User Tools

Site Tools


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 for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
enumerating_20the_20installed_20printers.txt · Last modified: 2018/04/17 16:05 by tbest3112