Class

IEnumVARIANT


Description

IEnumVARIANT provides methods for enumerating a collection of OLE VARIANTS. Most collections can also be iterated through a common API for Item and Count, but not all collections support this.

Properties

Name

Type

Read-Only

Shared

Handle

Ptr

Methods

Name

Parameters

Returns

Shared

AddRef

UInt32

Clone

Byref outEnum As Ptr

Boolean

Constructor

p As Ptr

Next_

celt As UInt32, ByRef rgVar As Variant, ByRef pCeltFetched As UInt32

Integer

QueryInterface

riid As Ptr, ByRef out As Ptr

Integer

Release

UInt32

Reset

Boolean

Skip

numElements As Integer

Boolean

Property descriptions


IEnumVARIANT.Handle

Handle As Ptr

Returns the raw IUnknown pointer.

Method descriptions


IEnumVARIANT.AddRef

AddRef As UInt32

Increments a reference count and returns the value of the reference count.


IEnumVARIANT.Clone

Clone(Byref outEnum As Ptr) As Boolean

Creates a copy of the current state of enumeration. Returns True on success and assigns outEnum with the new enumerator, False otherwise.


IEnumVARIANT.Constructor

Constructor(p As Ptr)

Note

Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.

Creates a new IUnknown class from the supplied pointer. The constructor does not automatically add a reference count, but when the destructor is called a reference is released.


IEnumVARIANT.Next_

Next_(celt As UInt32, ByRef rgVar As Variant, ByRef pCeltFetched As UInt32) As Integer

Attempts to get the next "numElement" items in the enumeration sequence, and return them in "var". Returns True if the number of elements returned matches "numElements", or False if the number of elements returned is less than "numElements"


IEnumVARIANT.QueryInterface

QueryInterface(riid As Ptr, ByRef out As Ptr) As Integer

Retrieves the address of a specified interface.

The following automates Internet Explorer and queries for a specific interface (each interface is identified by a unique IID)

Var ie As New OLEObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate("google.com")

Var unk As New COM.IUnknown(ie.Handle)

' Query for the IID_IWebBrowser2 interface
Var iid As MemoryBlock = COM.IIDFromString("{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}")
Var out As Ptr
If 0 = unk.QueryInterface(iid, out) Then
  ' Yay this interface exists
  Break
End If

IEnumVARIANT.Release

Release As UInt32

Decrements a reference count and returns the value of the reference count.


IEnumVARIANT.Reset

Reset As Boolean

Resets the enumeration sequence to the beginning. Returns True on success, False on failure.


IEnumVARIANT.Skip

Skip(numElements As Integer) As Boolean

Skips over the next "numElements" in the enumeration sequence. Returns true if successful, false otherwise.

Compatibility

All project types on all supported operating systems.

See also

IUnknown parent class; COM module; IUnknown, IPicture.