Jose's Read Only Forum 2023

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Windows Script Runtime => Source Code => Scripting => FileSystemObject => Topic started by: José Roca on July 14, 2008, 04:27:41 AM

Title: IDriveCollection.NewEnum_ Method
Post by: José Roca on July 14, 2008, 04:27:41 AM


The following code illustrates the use of the NewEnum_ method:


#INCLUDE "windows.inc"
#INCLUDE "scrrun.inc"

DIM fso AS IFileSystem
DIM pEnum AS IEnumVARIANT
DIM pDrive AS IDrive
DIM vItem AS VARIANT
DIM celtFetched AS DWORD

' Create an instance of the FileSystemObject
fso = NEWCOM "Scripting.FileSystemObject"
' Get a reference to the IDrives collection
pDrives = fso.GetDrives
' Get a reference to the standard enumerator
pEnum = pDrives.NewEnum_
' Enumerate the collection
DO
   pEnum.Next 1, vItem, celtFetched
   IF celtFetched = 0 THEN EXIT DO
   pDrive = vItem
   STDOUT ACODE$(pDrive.DriveLetter)
LOOP
[/copy]