代码改变世界

com 枚举器

2011-06-13 21:58  Clingingboy  阅读(736)  评论(0编辑  收藏  举报

 

interface IItems : IDispatch
{
    [id(DISPID_NEWENUM), propget]
    HRESULT _NewEnum([out, retval] IUnknown** ppUnk);

    [id(DISPID_VALUE), propget]
    HRESULT Item(
                    [in] VARIANT Index, 
                    [out, retval] VARIANT* pVal);

    [id(0x00000001), propget]
    HRESULT Count([out, retval] long * pVal);
}

Count:返回数量
Item:索引项
_NewEnum:返回枚举器

IEnumVARIANT : public IUnknown
{
public:
    virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( 
        /* [in] */ ULONG celt,
        /* [length_is][size_is][out] */ VARIANT *rgVar,
        /* [out] */ ULONG *pCeltFetched) = 0;
    
    virtual HRESULT STDMETHODCALLTYPE Skip( 
        /* [in] */ ULONG celt) = 0;
    
    virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
    
    virtual HRESULT STDMETHODCALLTYPE Clone( 
        /* [out] */ __RPC__deref_out_opt IEnumVARIANT **ppEnum) = 0;
    
};

Next:celt批量返回个数,pCeltFetched实际返回个数