ReactOS  0.4.14-dev-815-ge410a12
CFolderItems Class Reference

#include <CFolderItems.h>

Inheritance diagram for CFolderItems:
Collaboration diagram for CFolderItems:

Public Member Functions

 CFolderItems ()
 
 ~CFolderItems ()
 
HRESULT Initialize (LPITEMIDLIST idlist, Folder *parent)
 
virtual HRESULT STDMETHODCALLTYPE get_Count (long *plCount)
 
virtual HRESULT STDMETHODCALLTYPE get_Application (IDispatch **ppid)
 
virtual HRESULT STDMETHODCALLTYPE get_Parent (IDispatch **ppid)
 
virtual HRESULT STDMETHODCALLTYPE Item (VARIANT index, FolderItem **ppid)
 
virtual HRESULT STDMETHODCALLTYPE _NewEnum (IUnknown **ppunk)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 

Private Attributes

CComHeapPtr< ITEMIDLISTm_idlist
 
CComPtr< IEnumIDListm_EnumIDList
 
CComPtr< Folder > m_Folder
 
long m_Count
 

Additional Inherited Members

- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 57 of file CFolderItems.h.

Constructor & Destructor Documentation

◆ CFolderItems()

CFolderItems::CFolderItems ( )

Definition at line 172 of file CFolderItems.cpp.

173  :m_Count(-1)
174 {
175 }

◆ ~CFolderItems()

CFolderItems::~CFolderItems ( )

Definition at line 177 of file CFolderItems.cpp.

178 {
179 }

Member Function Documentation

◆ _NewEnum()

HRESULT STDMETHODCALLTYPE CFolderItems::_NewEnum ( IUnknown **  ppunk)
virtual

Definition at line 302 of file CFolderItems.cpp.

303 {
304  return ShellObjectCreatorInit<CFolderItems>(static_cast<LPITEMIDLIST>(m_idlist), m_Folder, IID_FolderItems, reinterpret_cast<void**>(ppunk));
305 }
CComPtr< Folder > m_Folder
Definition: CFolderItems.h:65
CComHeapPtr< ITEMIDLIST > m_idlist
Definition: CFolderItems.h:63

◆ get_Application()

HRESULT STDMETHODCALLTYPE CFolderItems::get_Application ( IDispatch **  ppid)
virtual

Definition at line 234 of file CFolderItems.cpp.

235 {
236  TRACE("(%p, %p)\n", this, ppid);
237  return m_Folder->get_Application(ppid);
238 }
CComPtr< Folder > m_Folder
Definition: CFolderItems.h:65
#define TRACE(s)
Definition: solgame.cpp:4

◆ get_Count()

HRESULT STDMETHODCALLTYPE CFolderItems::get_Count ( long plCount)
virtual

Definition at line 205 of file CFolderItems.cpp.

206 {
207  if (!m_EnumIDList)
208  return E_FAIL;
209 
210  if (!plCount)
211  return E_POINTER;
212 
213  if (m_Count == -1)
214  {
215  long count = 0;
216 
217  HRESULT hr = m_EnumIDList->Reset();
218  if (FAILED_UNEXPECTEDLY(hr))
219  return hr;
220 
222  while ((hr = m_EnumIDList->Next(1, &Pidl, 0)) != S_FALSE)
223  {
224  count++;
225  Pidl.Free();
226  }
227  m_Count = count;
228  }
229  *plCount = m_Count;
230 
231  return S_OK;
232 }
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define E_FAIL
Definition: ddrawi.h:102
#define S_FALSE
Definition: winerror.h:2357
CComPtr< IEnumIDList > m_EnumIDList
Definition: CFolderItems.h:64
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ get_Parent()

HRESULT STDMETHODCALLTYPE CFolderItems::get_Parent ( IDispatch **  ppid)
virtual

Definition at line 240 of file CFolderItems.cpp.

241 {
242  TRACE("(%p, %p)\n", this, ppid);
243 
244  if (ppid)
245  *ppid = NULL;
246 
247  return E_NOTIMPL;
248 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Initialize()

HRESULT CFolderItems::Initialize ( LPITEMIDLIST  idlist,
Folder *  parent 
)

Definition at line 181 of file CFolderItems.cpp.

182 {
183  CComPtr<IShellFolder> psfDesktop, psfTarget;
184 
185  m_idlist.Attach(ILClone(idlist));
186 
187  HRESULT hr = SHGetDesktopFolder(&psfDesktop);
188  if (FAILED_UNEXPECTEDLY(hr))
189  return hr;
190 
191  hr = psfDesktop->BindToObject(m_idlist, NULL, IID_PPV_ARG(IShellFolder, &psfTarget));
192  if (FAILED_UNEXPECTEDLY(hr))
193  return hr;
194 
195  hr = psfTarget->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &m_EnumIDList);
196 
197  if (FAILED_UNEXPECTEDLY(hr))
198  return hr;
199 
200  m_Folder = parent;
201  return S_OK;
202 }
CComPtr< Folder > m_Folder
Definition: CFolderItems.h:65
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
CComPtr< IEnumIDList > m_EnumIDList
Definition: CFolderItems.h:64
r parent
Definition: btrfs.c:2869
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define S_OK
Definition: intsafe.h:59
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
CComHeapPtr< ITEMIDLIST > m_idlist
Definition: CFolderItems.h:63

◆ Item()

HRESULT STDMETHODCALLTYPE CFolderItems::Item ( VARIANT  index,
FolderItem **  ppid 
)
virtual

Definition at line 250 of file CFolderItems.cpp.

251 {
253  HRESULT hr;
254 
255  if (!m_EnumIDList)
256  return E_FAIL;
257 
258  hr = VariantCopyInd(&index, &var);
259  if (FAILED(hr))
260  return hr;
261 
262  if (V_VT(&index) == VT_I2)
264 
265  if (V_VT(&index) == VT_I4)
266  {
267  ULONG count = V_UI4(&index);
268 
269  hr = m_EnumIDList->Reset();
270  if (FAILED_UNEXPECTEDLY(hr))
271  return hr;
272 
273  hr = m_EnumIDList->Skip(count);
274 
275  if (FAILED_UNEXPECTEDLY(hr))
276  return hr;
277 
279  hr = m_EnumIDList->Next(1, &spPidl, 0);
280  if (FAILED_UNEXPECTEDLY(hr))
281  return hr;
282  hr = ShellObjectCreatorInit<CFolderItem>(m_Folder, static_cast<LPITEMIDLIST>(spPidl), IID_PPV_ARG(FolderItem, ppid));
283  if (FAILED_UNEXPECTEDLY(hr))
284  return hr;
285  return hr;
286  }
287  else if (V_VT(&index) == VT_BSTR)
288  {
289  if (!V_BSTR(&index))
290  return S_FALSE;
291 
292  hr = m_Folder->ParseName(V_BSTR(&index), ppid);
293  if (FAILED_UNEXPECTEDLY(hr))
294  return hr;
295  return hr;
296  }
297 
298  FIXME("Index type %d not handled.\n", V_VT(&index));
299  return E_NOTIMPL;
300 }
CComPtr< Folder > m_Folder
Definition: CFolderItems.h:65
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
Definition: compat.h:1947
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:847
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
GLuint index
Definition: glext.h:6031
coclass Shell32::ShellFolderViewOC FolderItem
CComPtr< IEnumIDList > m_EnumIDList
Definition: CFolderItems.h:64
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define V_UI4(A)
Definition: oleauto.h:270
#define index(s, c)
Definition: various.h:29
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int ULONG
Definition: retypes.h:1
Definition: compat.h:1946

Member Data Documentation

◆ m_Count

long CFolderItems::m_Count
private

Definition at line 66 of file CFolderItems.h.

Referenced by get_Count().

◆ m_EnumIDList

CComPtr<IEnumIDList> CFolderItems::m_EnumIDList
private

Definition at line 64 of file CFolderItems.h.

Referenced by get_Count(), Initialize(), and Item().

◆ m_Folder

CComPtr<Folder> CFolderItems::m_Folder
private

Definition at line 65 of file CFolderItems.h.

Referenced by _NewEnum(), get_Application(), Initialize(), and Item().

◆ m_idlist

CComHeapPtr<ITEMIDLIST> CFolderItems::m_idlist
private

Definition at line 63 of file CFolderItems.h.

Referenced by _NewEnum(), and Initialize().


The documentation for this class was generated from the following files: