Interactive PowerBasic Forum

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Source Code => Scripting => Windows Script Host => Topic started by: José Roca on July 14, 2008, 08:28:03 PM

Title: IWshNetwork.EnumPrinterConnections Method
Post by: José Roca on July 14, 2008, 08:28:03 PM


The following code illustrates the use of the EnumPrinterConnections method:


#INCLUDE "WSHOM.INC"

DIM pWshNetwork AS IWshNetwork
DIM pPrinters AS IWshCollection
DIM i AS LONG
DIM v1 AS VARIANT
DIM v2 AS VARIANT

pWshNetwork = NEWCOM "WScript.Network"
pPrinters = pWshNetwork.EnumPrinterConnections
FOR i = 0 TO pPrinters.Count - 1 STEP 2
   v1 = pPrinters.Item(i)
   v2 = pPrinters.Item(i + 1)
   STDOUT "Printer " & VARIANT$(v1) & " = " & VARIANT$(v2)
NEXT