Author Topic: IDriveCollection.NewEnum_ Method  (Read 2884 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2517
  • User-Rate: +209/-0
  • Gender: Male
IDriveCollection.NewEnum_ Method
« on: July 14, 2008, 04:27:41 AM »

The following code illustrates the use of the NewEnum_ method:

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