Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
4.9 KiB

  1. /*
  2. * f o l d e r s
  3. *
  4. * Purpose:
  5. *
  6. * History
  7. *
  8. * Copyright (C) Microsoft Corp. 1995, 1996.
  9. */
  10. #ifndef _FOLDERS_H
  11. #define _FOLDERS_H
  12. #include "privunk.h"
  13. #include "basedisp.h"
  14. interface IOEFolderCollection;
  15. interface IOEFolder;
  16. HRESULT CreateInstance_OEFolderCollection(IUnknown *pUnkOuter, IUnknown **ppUnknown);
  17. class COEFolderCollection:
  18. public IOEFolderCollection,
  19. public CBaseDisp
  20. {
  21. public:
  22. // *** IUnknown ***
  23. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj)
  24. { return CBaseDisp::QueryInterface(riid, ppvObj); };
  25. virtual STDMETHODIMP_(ULONG) AddRef(void)
  26. { return CBaseDisp::AddRef();};
  27. virtual STDMETHODIMP_(ULONG) Release(void)
  28. { return CBaseDisp::Release(); };
  29. // *** IDispatch ***
  30. virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
  31. { return CBaseDisp::GetTypeInfoCount(pctinfo); };
  32. virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  33. { return CBaseDisp::GetTypeInfo(itinfo, lcid, pptinfo); };
  34. virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
  35. { return CBaseDisp::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); };
  36. virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
  37. { return CBaseDisp::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); };
  38. // *** IOEFolderCollection ***
  39. virtual HRESULT STDMETHODCALLTYPE get_length(long * p);
  40. virtual HRESULT STDMETHODCALLTYPE get__newEnum(IUnknown **p);
  41. virtual HRESULT STDMETHODCALLTYPE item(VARIANT name, VARIANT index, IDispatch** pdisp);
  42. virtual HRESULT STDMETHODCALLTYPE add(BSTR bstrName, IDispatch **ppDisp);
  43. virtual HRESULT STDMETHODCALLTYPE get_folders(IOEFolderCollection **p);
  44. // *** Override CBaseDisp ***
  45. virtual HRESULT STDMETHODCALLTYPE InterfaceSupportsErrorInfo(REFIID riid);
  46. COEFolderCollection();
  47. virtual ~COEFolderCollection();
  48. HRESULT Init(FOLDERID idFolder);
  49. private:
  50. virtual HRESULT PrivateQueryInterface(REFIID riid, LPVOID * ppvObj);
  51. HRESULT _EnsureInit();
  52. HRESULT _FindFolder(BSTR bstr, LONG lIndex, FOLDERID *pidFolder);
  53. FOLDERID m_idFolder;
  54. IEnumerateFolders *m_pEnumChildren;
  55. };
  56. HRESULT CreateFolderCollection(FOLDERID idFolder, IOEFolderCollection **ppFolderCollection);
  57. class COEFolder:
  58. public IOEFolder,
  59. public CBaseDisp
  60. {
  61. public:
  62. // ---------------------------------------------------------------------------
  63. // IUnknown members
  64. // ---------------------------------------------------------------------------
  65. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj)
  66. { return PrivateQueryInterface(riid, ppvObj); };
  67. virtual STDMETHODIMP_(ULONG) AddRef(void)
  68. { return ++m_cRef; };
  69. virtual STDMETHODIMP_(ULONG) Release(void)
  70. { m_cRef--; if (m_cRef == 0) {delete this; return 0;} return m_cRef; };
  71. // *** IDispatch)
  72. virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
  73. { return CBaseDisp::GetTypeInfoCount(pctinfo); };
  74. virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  75. { return CBaseDisp::GetTypeInfo(itinfo, lcid, pptinfo); };
  76. virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
  77. { return CBaseDisp::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); };
  78. virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
  79. { return CBaseDisp::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); };
  80. // *** IOEFolder**
  81. virtual HRESULT STDMETHODCALLTYPE get_messages(IOEMessageCollection **p);
  82. virtual HRESULT STDMETHODCALLTYPE get_folders(IOEFolderCollection **p);
  83. virtual HRESULT STDMETHODCALLTYPE get_name(BSTR *pbstr);
  84. virtual HRESULT STDMETHODCALLTYPE put_name(BSTR bstr);
  85. virtual HRESULT STDMETHODCALLTYPE get_size(LONG *pl);
  86. virtual HRESULT STDMETHODCALLTYPE get_unread(LONG *pl);
  87. virtual HRESULT STDMETHODCALLTYPE get_count(LONG *pl);
  88. virtual HRESULT STDMETHODCALLTYPE get_id(LONG *pl);
  89. COEFolder();
  90. virtual ~COEFolder();
  91. HRESULT Init(FOLDERID idFolder);
  92. private:
  93. ULONG m_cRef;
  94. FOLDERID m_idFolder;
  95. FOLDERINFO m_fi;
  96. virtual HRESULT PrivateQueryInterface(REFIID riid, LPVOID * ppvObj);
  97. HRESULT _EnsureInit();
  98. };
  99. HRESULT CreateOEFolder(FOLDERID idFolder, IOEFolder **ppFolder);
  100. #endif //_FOLDERS_H