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


Groups > comp.lang.clipper.visual-objects > #4991 > unrolled thread

How can I get a list of installed printers?

Started byBGeorge21@in.gr
First post2013-03-30 10:13 -0700
Last post2013-04-02 21:39 -0700
Articles 7 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  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

#4991 — How can I get a list of installed printers?

FromBGeorge21@in.gr
Date2013-03-30 10:13 -0700
SubjectHow can I get a list of installed printers?
Message-ID<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 

[toc] | [next] | [standalone]


#4992

From"Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Date2013-03-30 20:50 +0100
Message-ID<arotvrFj2saU1@mid.individual.net>
In reply to#4991
Hi George,
I sent directly to you a AEF with some hints because the binary file was 
rejected by the news-server. Watch your mail.
Urs


<BGeorge21@in.gr> schrieb im Newsbeitrag 
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 

[toc] | [prev] | [next] | [standalone]


#4995

FromBGeorge <bgeorge21@in.gr>
Date2013-03-31 09:24 -0700
Message-ID<4eb1ac6e-2c6d-45c0-ab14-e9176ec4027b@googlegroups.com>
In reply to#4991
Τη Σάββατο, 30 Μαρτίου 2013 7:13:27 μ.μ. UTC+2, ο χρήστης BGeorge έγραψε:
> 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

Thank you very much.

[toc] | [prev] | [next] | [standalone]


#4996

From"Craig Dawson" <craig@control.net.au>
Date2013-04-01 09:08 +1100
Message-ID<kjac17$q8h$1@dont-email.me>
In reply to#4991
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 

[toc] | [prev] | [next] | [standalone]


#4998

FromBGeorge <bgeorge21@in.gr>
Date2013-04-01 08:12 -0700
Message-ID<fb087c2c-d138-40f0-9d7b-b6d7bab65d63@googlegroups.com>
In reply to#4996
The function IsWinNT is unknown and i don't known what exactly check to return TRUE/FALSE. If you want to help me with this.

Thank you again
regards
George

Τη Δευτέρα, 1 Απριλίου 2013 1:08:45 π.μ. UTC+3, ο χρήστης Craig Dawson έγραψε:
> 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

[toc] | [prev] | [next] | [standalone]


#5004

From"Craig Dawson" <craig@control.net.au>
Date2013-04-03 10:11 +1100
Message-ID<kjfoem$vf$1@dont-email.me>
In reply to#4998
George, here you go. I should have included it for you before.
Regards, Craig.

FUNCTION IsWinNT() AS LOGIC PASCAL
LOCAL osVersionInfo IS _WinOSVersionInfo // Are we currently running under 
NT operating system
osVersionInfo.dwOSVersionInfoSize := _SIZEOF(_WinOSVersionInfo)
GetVersionEx(@osVersionInfo)
RETURN IIF(osVersionInfo.dwPlatformID == VER_PLATFORM_WIN32_NT,TRUE,FALSE)



"BGeorge" <bgeorge21@in.gr> wrote in message 
news:fb087c2c-d138-40f0-9d7b-b6d7bab65d63@googlegroups.com...
The function IsWinNT is unknown and i don't known what exactly check to 
return TRUE/FALSE. If you want to help me with this.

Thank you again
regards
George


[toc] | [prev] | [next] | [standalone]


#5005

FromBGeorge <bgeorge21@in.gr>
Date2013-04-02 21:39 -0700
Message-ID<066d9efe-52d2-47bd-9a5f-e0378d286e78@googlegroups.com>
In reply to#5004
Thank you Craig, it works perfect.

Thank you again
regards
George

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web