• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

IWshCollection.length Property

Started by José Roca, July 14, 2008, 10:52:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following code illustrates the use of the length method:


#INCLUDE "WSHOM.INC"

DIM pWsh AS IWshShell
DIM pSpecialFolders AS IWshCollection
DIM nLen AS LONG
DIM i AS LONG
DIM vItem AS VARIANT
DIM vValue AS VARIANT

pWsh = NEWCOM "WScript.Shell"
' Get a reference to the special folders collection
pSpecialFolders = pWsh.SpecialFolders

' Get the number of objects in the collection
nLen = pSpecialFolders.length

' Enumerates the collection
FOR i = 0 TO nLen - 1
   vItem = i AS LONG
   vValue = pSpecialFolders.Item(vItem)
   IF OBJRESULT THEN EXIT FOR
   STDOUT VARIANT$(vValue)
NEXT