|
#pragma once
#include <atlcom.h>
// CComEnum2<> extends ATL CComEnum<> that the Next() method initializes its T parameter
template <class Base, const IID* piid, class T, class Copy, class ThreadModel = CComObjectThreadModel>
class CComEnum2 :
public CComEnum<Base, piid, T, Copy, ThreadModel>
{
public:
STDMETHOD(Next)(ULONG celt, T* rgelt, ULONG* pceltFetched)
{
*rgelt = T();
return CComEnum::Next(celt, rgelt, pceltFetched);
}
};
// CComEnum2<> template class specialization where T = VARIANT
// This will overcome a bug in CF3.5 that will check erroneously VARIANT vt type
// when the last item of an IEnumVariant is checked for validity. CComEnum<> returns than S_FALSE
template <class Base, const IID* piid, class Copy, class ThreadModel/* = CComObjectThreadModel*/>
class CComEnum2<Base, piid, VARIANT, Copy, ThreadModel> :
public CComEnum<Base, piid, VARIANT, Copy, ThreadModel>
{
public:
STDMETHOD(Next)(ULONG celt, VARIANT* rgelt, ULONG* pceltFetched)
{
VariantInit(rgelt);
return CComEnum::Next(celt, rgelt, pceltFetched);
}
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.