Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #4996

Re: How can I get a list of installed printers?

From "Craig Dawson" <craig@control.net.au>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: How can I get a list of installed printers?
Date 2013-04-01 09:08 +1100
Organization A noiseless patient Spider
Message-ID <kjac17$q8h$1@dont-email.me> (permalink)
References <e7f787dd-c665-4331-a83d-ad3c1b163edd@googlegroups.com>

Show all headers | View raw


This is what I use.
It retruns an array of installed printers.
Hope it helps.
Regards, Craig Dawson.

FUNCTION GetPrinterList() AS ARRAY
//p Return an array of installed printers
LOCAL aPrinters AS ARRAY
LOCAL i, nSize, nPrintLevel, nPrintSize AS DWORD
LOCAL ptrSave AS PTR
LOCAL oPrintInfo4 AS _winPRINTER_INFO_4
LOCAL oPrintInfo5 AS _winPRINTER_INFO_5
aPrinters := {}
IF IsWinNT()
nPrintLevel := 4
nPrintSize := _SIZEOF(_winPRINTER_INFO_4)
EnumPrinters(PRINTER_ENUM_LOCAL + PRINTER_ENUM_CONNECTIONS, NULL_PSZ, 
nPrintLevel, NULL_PTR, 0, @nSize, @i)
IF nSize != 0
ptrSave := oPrintInfo4 := MemAlloc(nSize)
IF EnumPrinters(PRINTER_ENUM_LOCAL + PRINTER_ENUM_CONNECTIONS, 
NULL_PSZ,nPrintLevel, oPrintInfo4, nSize, @i, @nSize)
FOR i := 1 UPTO nSize
AAdd(aPrinters, Psz2String(oPrintInfo4.pPrinterName))
oPrintInfo4 := PTR(_CAST, DWORD(_CAST, oPrintInfo4) + nPrintSize)
NEXT i
ENDIF
MemFree(ptrSave)
ENDIF
ELSE
nPrintLevel := 5
nPrintSize := _SIZEOF(_winPRINTER_INFO_5)
EnumPrinters(PRINTER_ENUM_LOCAL, NULL_PSZ, nPrintLevel, NULL_PTR, 0,@nSize, 
@i)
IF nSize != 0
ptrSave := oPrintInfo5 := MemAlloc(nSize)
IF EnumPrinters(PRINTER_ENUM_LOCAL + PRINTER_ENUM_NETWORK, 
NULL_PSZ,nPrintLevel, oPrintInfo5, nSize, @i, @nSize)
FOR i := 1 UPTO nSize
AAdd(aPrinters, Psz2String(oPrintInfo5.pPrinterName))
oPrintInfo5 := PTR(_CAST, DWORD(_CAST, oPrintInfo5) + nPrintSize)
NEXT i
ENDIF
MemFree(ptrSave)
ENDIF
ENDIF
RETURN aPrinters


<BGeorge21@in.gr> wrote in message 
news:e7f787dd-c665-4331-a83d-ad3c1b163edd@googlegroups.com...
> how I can get a list of installed printers in order to pass them to a 
> ComboBox to select the user in the programming language Visual Objects?
>
> Thanks 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How can I get a list of installed printers? BGeorge21@in.gr - 2013-03-30 10:13 -0700
  Re: How can I get a list of installed printers? "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2013-03-30 20:50 +0100
  Re: How can I get a list of installed printers? BGeorge <bgeorge21@in.gr> - 2013-03-31 09:24 -0700
  Re: How can I get a list of installed printers? "Craig Dawson" <craig@control.net.au> - 2013-04-01 09:08 +1100
    Re: How can I get a list of installed printers? BGeorge <bgeorge21@in.gr> - 2013-04-01 08:12 -0700
      Re: How can I get a list of installed printers? "Craig Dawson" <craig@control.net.au> - 2013-04-03 10:11 +1100
        Re: How can I get a list of installed printers? BGeorge <bgeorge21@in.gr> - 2013-04-02 21:39 -0700

csiph-web