• Welcome to Jose's Read Only Forum 2023.
 

IDriveCollection.NewEnum_ Method

Started by José Roca, July 14, 2008, 04:27:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



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]