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.

244 lines
7.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1995.
  5. //
  6. // File: jobfldr.hxx
  7. //
  8. // Contents: Declaration of COM object CJobFolder
  9. //
  10. // History: 1/4/1996 RaviR Created
  11. // 1-23-1997 DavidMun Add m_hwndNotify member
  12. //
  13. //----------------------------------------------------------------------------
  14. #ifndef __JOBFLDR_HXX__
  15. #define __JOBFLDR_HXX__
  16. #include "dll.hxx"
  17. #include <mstask.h>
  18. #define INVALID_LISTVIEW_STYLE 0xFFFFFFFF
  19. //____________________________________________________________________________
  20. //
  21. // Class: CJobFolder
  22. //
  23. // History: 1/4/1996 RaviR Created
  24. //____________________________________________________________________________
  25. class CJobFolder : public IShellFolder2,
  26. #if (_WIN32_IE >= 0x0400)
  27. public IPersistFolder2,
  28. #else
  29. public IPersistFolder,
  30. #endif // (_WIN32_IE >= 0x0400)
  31. public IRemoteComputer,
  32. public IDropTarget
  33. {
  34. public:
  35. static HRESULT Create(CJobFolder ** ppJobFolder);
  36. ~CJobFolder();
  37. // IUnknown methods
  38. DECLARE_STANDARD_IUNKNOWN;
  39. // IRemoteComputer method
  40. STDMETHOD(Initialize)(LPCWSTR pszMachine, BOOL bEnumerating);
  41. // IPersist methods
  42. STDMETHOD(GetClassID)(LPCLSID lpClassID);
  43. // IPersistFolder methods
  44. STDMETHOD(Initialize)(LPCITEMIDLIST pidl);
  45. #if (_WIN32_IE >= 0x0400)
  46. // IPersistFolder2 methods
  47. STDMETHOD(GetCurFolder)(LPITEMIDLIST *ppidl);
  48. #endif // (_WIN32_IE >= 0x0400)
  49. // IShellFolder methods
  50. STDMETHOD(ParseDisplayName)(HWND hwndOwner, LPBC pbcReserved,
  51. LPOLESTR lpszDisplayName, ULONG* pchEaten,
  52. LPITEMIDLIST* ppidl, ULONG* pdwAttributes);
  53. STDMETHOD(EnumObjects)(HWND hwndOwner, DWORD grfFlags,
  54. LPENUMIDLIST* ppenumIDList);
  55. STDMETHOD(BindToObject)(LPCITEMIDLIST pidl, LPBC pbcReserved,
  56. REFIID riid, LPVOID* ppvOut);
  57. STDMETHOD(BindToStorage)(LPCITEMIDLIST pidl, LPBC pbcReserved,
  58. REFIID riid, LPVOID* ppvObj);
  59. STDMETHOD(CompareIDs)(LPARAM lParam, LPCITEMIDLIST pidl1,
  60. LPCITEMIDLIST pidl2);
  61. STDMETHOD(CreateViewObject)(HWND hwndOwner, REFIID riid, LPVOID* ppvOut);
  62. STDMETHOD(GetAttributesOf)(UINT cidl, LPCITEMIDLIST* apidl, ULONG* rgfInOut);
  63. STDMETHOD(GetUIObjectOf)(HWND hwndOwner, UINT cidl, LPCITEMIDLIST* apidl,
  64. REFIID riid, UINT* prgfInOut, LPVOID* ppvOut);
  65. STDMETHOD(GetDisplayNameOf)(LPCITEMIDLIST pidl, DWORD uFlags,
  66. LPSTRRET lpName);
  67. STDMETHOD(SetNameOf)(HWND hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpszName,
  68. DWORD uFlags, LPITEMIDLIST* ppidlOut);
  69. // IShellFolder2
  70. STDMETHOD(GetDefaultSearchGUID)(GUID *pguid);
  71. STDMETHOD(EnumSearches)(IEnumExtraSearch **ppenum);
  72. STDMETHOD(GetDefaultColumn)(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
  73. STDMETHOD(GetDefaultColumnState)( UINT iColumn, SHCOLSTATEF *pcsFlags);
  74. STDMETHOD(GetDetailsEx)( LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv);
  75. STDMETHOD(GetDetailsOf)( LPCITEMIDLIST pidl,UINT iColumn,SHELLDETAILS *psd);
  76. STDMETHOD(MapColumnToSCID)(UINT iColumn, SHCOLUMNID *pscid);
  77. // IDropTarget
  78. STDMETHOD(DragEnter)(LPDATAOBJECT pdtobj, DWORD grfKeyState,
  79. POINTL pt, DWORD *pdwEffect);
  80. STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  81. STDMETHOD(DragLeave)(void);
  82. STDMETHOD(Drop)(LPDATAOBJECT pdtobj, DWORD grfKeyState,
  83. POINTL pt, DWORD *pdwEffect);
  84. // Method required to handle dir change notification
  85. LPCTSTR GetFolderPath(void) const { return m_pszFolderPath; }
  86. LPSHELLVIEW GetShellView(void) const { return m_pShellView; }
  87. HRESULT CreateAJobForApp(LPCTSTR pszApp);
  88. LRESULT HandleFsNotify(LONG lNotification, LPCITEMIDLIST* ppidl);
  89. void OnUpdateDir(void);
  90. HRESULT CopyToFolder(LPDATAOBJECT pdtobj, BOOL fMove,
  91. BOOL fDragDrop, POINTL * pPtl);
  92. LPCTSTR GetMachine() const { return m_pszMachine; }
  93. private:
  94. CJobFolder(void);
  95. HRESULT _GetJobScheduler(void);
  96. static HRESULT CALLBACK s_JobsFVCallBack(LPSHELLVIEW psvOuter,
  97. LPSHELLFOLDER psf, HWND hwndOwner, UINT uMsg,
  98. WPARAM wParam, LPARAM lParam);
  99. HRESULT CALLBACK _JobsFVCallBack(LPSHELLVIEW psvOuter,
  100. LPSHELLFOLDER psf, HWND hwndOwner, UINT uMsg,
  101. WPARAM wParam, LPARAM lParam);
  102. HRESULT _InitRest(void);
  103. int _UpdateJob(LPTSTR pszJob, FILETIME *pftLastWriteTime);
  104. BOOL _PopupRBMoveCtx(LONG x, LONG y, BOOL *pfMove);
  105. HRESULT _AddObject(PJOBID pjid, LPITEMIDLIST *ppidl = NULL);
  106. HRESULT _UpdateObject(PJOBID pjidOld, PJOBID pjidNew,
  107. LPITEMIDLIST *ppidl = NULL);
  108. INT_PTR _RemoveObject(PJOBID pjid)
  109. {
  110. return ShellFolderView_RemoveObject(m_hwndOwner, pjid);
  111. }
  112. BOOL _ObjectAlreadyPresent(LPTSTR pszObj);
  113. int _GetJobIDForTask(PJOBID * ppjid, int count, LPTSTR pszTask);
  114. ULONG _GetChildListViewMode(HWND hwndOwner);
  115. void _SetViewMode(HWND hwndOwner, ULONG ulStyle);
  116. HWND m_hwndOwner;
  117. HWND m_hwndNotify; // JF Notify window
  118. LPITEMIDLIST m_pidlFldr;
  119. ULONG m_uRegister;
  120. IShellView * m_pShellView;
  121. ITaskScheduler * m_pScheduler;
  122. LPTSTR m_pszMachine;
  123. LPCTSTR m_pszFolderPath;
  124. CDllRef m_DllRef;
  125. ULONG m_ulListViewModeOnEntry;
  126. //
  127. // Data used for drag drop
  128. //
  129. DWORD m_grfKeyStateLast;
  130. //
  131. // QCMINFO got during DVM_MERGEMENU and used during DVM_INVOKECOMMAND
  132. // in _JobsFVCallBack
  133. //
  134. QCMINFO m_qcm;
  135. //
  136. // data used by _OnUpdateDir
  137. //
  138. PBYTE m_pUpdateDirData;
  139. int m_cObjsAlloced;
  140. }; // class CJobFolder
  141. //____________________________________________________________________________
  142. //
  143. // Member: CJobFolder::CJobFolder, Constructor
  144. //____________________________________________________________________________
  145. inline
  146. CJobFolder::CJobFolder(void)
  147. :
  148. m_ulRefs(1),
  149. m_hwndOwner(NULL),
  150. m_hwndNotify(NULL),
  151. m_pidlFldr(NULL),
  152. m_uRegister(0),
  153. m_pShellView(NULL),
  154. m_pScheduler(NULL),
  155. m_pszMachine(NULL),
  156. m_pszFolderPath(NULL),
  157. m_pUpdateDirData(NULL),
  158. m_cObjsAlloced(0),
  159. m_ulListViewModeOnEntry(INVALID_LISTVIEW_STYLE)
  160. {
  161. TRACE(CJobFolder, CJobFolder);
  162. }
  163. //____________________________________________________________________________
  164. //
  165. // Member: CJobFolder::_InitRest
  166. //
  167. // Returns: HRESULT
  168. //
  169. // History: 2/20/1996 RaviR Created
  170. //
  171. //____________________________________________________________________________
  172. inline
  173. HRESULT
  174. CJobFolder::_InitRest(void)
  175. {
  176. TRACE(CJobFolder, _InitRest);
  177. // Get the scheduler & cache it
  178. return JFGetJobScheduler(m_pszMachine, &m_pScheduler, &m_pszFolderPath);
  179. }
  180. #endif // __JOBFLDR_HXX__