OPENPRINTER

Top  Previous  Next

Syntax

UINT = OPENPRINTER(name as STRING,title as STRING,mode as STRING)

Description

Opens a printer for writing.

Parameters

name - Name of printer returned by GETDEFAULTPRINTER or PRTDIALOG.

title - Title of print job to display in the print manager.

mode - "RAW" or "TEXT"

Return value

A handle to the open printer or 0 if the printer could not be found.

Remarks

Not all printers support direct text printing. Printers sold as "GDI Only" do not include built in fonts and will not work with the WRITEPRINTER command. For "GDI Only" printers use the PRINTWINDOW command instead.

See Also: WRITEPRINTER, CLOSEPRINTER, PRTDIALOG, GETDEFAULTPRINTER

Example usage

prtname = GETDEFAULTPRINTER
hPrinter = OPENPRINTER(prtname, "Job 1", "TEXT")
IF hPrinter
    WRITEPRINTER hPrinter, "This is line 1\n"
    CLOSEPRINTER hPrinter
ENDIF