SYMPTOMS
The signatures for the unmanaged
IEnumVARIANT::Next method and for the
IEnumVARIANT::Clone method are the following.
IEnumVARIANT::Next
HRESULT Next(
unsigned long celt,
VARIANT FAR* rgVar,
unsigned long FAR* pCeltFetched
);
IEnumVARIANT::Clone
HRESULT Clone(
IEnumVARIANT FAR* FAR* ppEnum
);
However, the
UCOMIEnumVARIANT interface does not define these methods correctly. The following
are the current incorrect signatures for these methods.
UCOMIEnumVARIANT.Next
int Next(
int celt,
int rgvar,
int pceltFetched
);
UCOMIEnumVARIANT.Clone
void Clone(
int ppenum
);
Note In the
UCOMIEnumVARIANT.Next method, the
rgvar parameter is defined as an int instead of as an object.
Additionally, in the
UCOMIEnumVARIANT.Clone method, the
ppenum parameter is defined as an int instead of as
UCOMIEnumVARIANT. Therefore, it is difficult to use the
UCOMIEnumVARIANT interface to enumerate a collection of variants.
WORKAROUND
You can write you own definition of the
IEnumVARIANT interface. The following code is an example on how to do this.
[
ComImport(),
Guid("00020404-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)
]
interface IEnumVARIANT
{
[PreserveSig()]
int Next(
int celt,
out object rgVar,
out int pCeltFetched);
[PreserveSig()]
int Skip(
int celt);
[PreserveSig()]
uint Reset();
IEnumVARIANT Clone();
}