Author Topic: IWshNetwork.EnumPrinterConnections Method  (Read 2808 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2524
  • User-Rate: +209/-0
  • Gender: Male
IWshNetwork.EnumPrinterConnections Method
« on: July 14, 2008, 08:28:03 PM »

The following code illustrates the use of the EnumPrinterConnections method:

Code: [Select]
#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