- #if !defined(AFX_ENUMFORMATETC_H__20001229_075F_904E_7D1B_0080AD509054__INCLUDED_)
- #define AFX_ENUMFORMATETC_H__20001229_075F_904E_7D1B_0080AD509054__INCLUDED_
- #pragma once
- #include "Misc.h"
- /////////////////////////////////////////////////////////////////////////////
- // CEnumFORMATETC
- class ATL_NO_VTABLE CEnumFORMATETC :
- public CComObjectRootEx<CComSingleThreadModel>,
- public IEnumFORMATETC
- {
- public:
- DECLARE_NOT_AGGREGATABLE(CEnumFORMATETC)
- BEGIN_COM_MAP(CEnumFORMATETC)
- COM_INTERFACE_ENTRY(IEnumFORMATETC)
- END_COM_MAP()
- CEnumFORMATETC() : m_dwEnumPos(0)
- {
- }
- ULONG m_dwEnumPos;
- // IEnumFORMATETC
- STDMETHOD(Next)(ULONG, LPFORMATETC pFormatetc, ULONG *pdwCopied)
- {
- VALIDATE_POINTER(pFormatetc);
- if( pdwCopied!=NULL ) *pdwCopied = 1L;
- m_dwEnumPos++;
- switch( m_dwEnumPos ) {
- case 1:
- pFormatetc->cfFormat = _Module.m_CFSTR_FILEDESCRIPTOR;
- pFormatetc->ptd = NULL;
- pFormatetc->dwAspect = DVASPECT_CONTENT;
- pFormatetc->lindex = -1;
- pFormatetc->tymed = TYMED_HGLOBAL;
- break;
- case 2:
- pFormatetc->cfFormat = _Module.m_CFSTR_FILECONTENTS;
- pFormatetc->ptd = NULL;
- pFormatetc->dwAspect = DVASPECT_CONTENT;
- pFormatetc->lindex = -1;
- pFormatetc->tymed = TYMED_ISTREAM;
- break;
- case 3:
- pFormatetc->cfFormat = _Module.m_CFSTR_PERFORMEDDROPEFFECT;
- pFormatetc->ptd = NULL;
- pFormatetc->dwAspect = DVASPECT_CONTENT;
- pFormatetc->lindex = -1;
- pFormatetc->tymed = TYMED_HGLOBAL;
- break;
- case 4:
- pFormatetc->cfFormat = _Module.m_CFSTR_PASTESUCCEEDED;
- pFormatetc->ptd = NULL;
- pFormatetc->dwAspect = DVASPECT_CONTENT;
- pFormatetc->lindex = -1;
- pFormatetc->tymed = TYMED_HGLOBAL;
- break;
- case 5:
- pFormatetc->cfFormat = _Module.m_CFSTR_PREFERREDDROPEFFECT;
- pFormatetc->ptd = NULL;
- pFormatetc->dwAspect = DVASPECT_CONTENT;
- pFormatetc->lindex = -1;
- pFormatetc->tymed = TYMED_HGLOBAL;
- break;
- default:
- if( pdwCopied!=NULL ) *pdwCopied = 0L;
- return S_FALSE;
- }
- return S_OK;
- }
- STDMETHOD(Skip)(ULONG n)
- {
- m_dwEnumPos += n;
- return S_OK;
- }
- STDMETHOD(Reset)(void)
- {
- m_dwEnumPos = 0L;
- return S_OK;
- }
- STDMETHOD(Clone)(LPENUMFORMATETC*)
- {
- ATLTRACENOTIMPL(_T("CEnumFORMATETC::Clone"));
- }
- };
- #endif // !defined(AFX_ENUMFORMATETC_H__20001229_075F_904E_7D1B_0080AD509054__INCLUDED_)