EnumPrinterConnections Method |
Description
Returns the current network printer mapping information.
PowerBASIC Syntax
Remarks
The EnumPrinterConnections method returns a collection. This collection is an array that associates pairs of items — network printer local names and their associated UNC names. Even-numbered items in the collection represent printer ports. Odd-numbered items represent the networked printer UNC names. The first item in the collection is at index zero (0).
Example [PowerBASIC]
#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
|