Consultor Eletrônico



Kbase P9288: How to list all connected printer names and printer ports in Windows?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   06/04/2011
Status: Verified

GOAL:

How to list all connected printer names and printer ports in Windows?

GOAL:

ABL / 4GL declaration for EnumPrinters function of Windows Print Spooler API

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x

FIX:

Use the windows API function call:

PROCEDURE EnumPrintersA EXTERNAL "winspool.drv":
/* printer object types */
DEFINE INPUT PARAMETER iFlags AS LONG.
/* name of printer object */
DEFINE INPUT PARAMETER cName AS CHARACTER.
/* information level */
DEFINE INPUT PARAMETER iLevel AS LONG.
/* printer information buffer */
DEFINE INPUT PARAMETER pPrinterEnum AS LONG.
/* size of printer information buffer */
DEFINE INPUT PARAMETER cbBuf AS LONG.
/* bytes received or required */
DEFINE OUTPUT PARAMETER pcbNeeded AS LONG.
/* number of printers enumerated */
DEFINE OUTPUT PARAMETER pcReturned AS LONG.
/* iResultReturned = 0 when on error */
DEFINE RETURN PARAMETER iResultReturned AS LONG.
END PROCEDURE.