ObjectCollectionOpen

Initializes enumeration of a COM/OLE collection object.

Syntax:

ObjectCollectionOpen( objecthandle)

Parameters:

(i) objecthandle the handle of a COM/OLE object that represents a collectionof variants, and which supports enumeration via the IEnumVARIANT interface..

Returns:

(i) handle enumeration handle

 

ObjectCollectionOpen is now obsolete. Use ForEach to enumerate through an object collection.

This function returns an enumeration handle, which can be used by the ObjectCollectionNext function to return items in the collection, one at a time. When you have finished enumeration, use the ObjectCollectionClose function to release the enumeration handle.

Example:


objFSO = ObjectOpen("Scripting.FilesystemObject")
objDrives = objFSO.Drives
hEnum = ObjectCollectionOpen(objDrives)
While 1
   objDrive = ObjectCollectionNext(hEnum)
   If objDrive == 0 Then Break
   Message("", objDrive.Path)
   ObjectClose(objDrive)
EndWhile
ObjectCollectionClose(hEnum)
ObjectClose(objDrives)
ObjectClose(objFSO)
See Also:

ObjectCollectionNext, ObjectCollectionClose, COM/OLE, ObjectOpen, ForEach