Source code of Windows XP (NT5)
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.

229 lines
6.7 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 IShellFolder,
  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. // IDropTarget
  70. STDMETHOD(DragEnter)(LPDATAOBJECT pdtobj, DWORD grfKeyState,
  71. POINTL pt, DWORD *pdwEffect);
  72. STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  73. STDMETHOD(DragLeave)(void);
  74. STDMETHOD(Drop)(LPDATAOBJECT pdtobj, DWORD grfKeyState,
  75. POINTL pt, DWORD *pdwEffect);
  76. // Method required to handle dir change notification
  77. LPCTSTR GetFolderPath(void) const { return m_pszFolderPath; }
  78. LPSHELLVIEW GetShellView(void) const { return m_pShellView; }
  79. HRESULT CreateAJobForApp(LPCTSTR pszApp);
  80. LRESULT HandleFsNotify(LONG lNotification, LPCITEMIDLIST* ppidl);
  81. void OnUpdateDir(void);
  82. HRESULT CopyToFolder(LPDATAOBJECT pdtobj, BOOL fMove,
  83. BOOL fDragDrop, POINTL * pPtl);
  84. LPCTSTR GetMachine() const { return m_pszMachine; }
  85. private:
  86. CJobFolder(void);
  87. HRESULT _GetJobScheduler(void);
  88. static HRESULT CALLBACK s_JobsFVCallBack(LPSHELLVIEW psvOuter,
  89. LPSHELLFOLDER psf, HWND hwndOwner, UINT uMsg,
  90. WPARAM wParam, LPARAM lParam);
  91. HRESULT CALLBACK _JobsFVCallBack(LPSHELLVIEW psvOuter,
  92. LPSHELLFOLDER psf, HWND hwndOwner, UINT uMsg,
  93. WPARAM wParam, LPARAM lParam);
  94. HRESULT _InitRest(void);
  95. int _UpdateJob(LPTSTR pszJob, FILETIME *pftLastWriteTime);
  96. BOOL _PopupRBMoveCtx(LONG x, LONG y, BOOL *pfMove);
  97. HRESULT _AddObject(PJOBID pjid, LPITEMIDLIST *ppidl = NULL);
  98. HRESULT _UpdateObject(PJOBID pjidOld, PJOBID pjidNew,
  99. LPITEMIDLIST *ppidl = NULL);
  100. INT_PTR _RemoveObject(PJOBID pjid)
  101. {
  102. return ShellFolderView_RemoveObject(m_hwndOwner, pjid);
  103. }
  104. BOOL _ObjectAlreadyPresent(LPTSTR pszObj);
  105. int _GetJobIDForTask(PJOBID * ppjid, int count, LPTSTR pszTask);
  106. ULONG _GetChildListViewMode(HWND hwndOwner);
  107. void _SetViewMode(HWND hwndOwner, ULONG ulStyle);
  108. HWND m_hwndOwner;
  109. HWND m_hwndNotify; // JF Notify window
  110. LPITEMIDLIST m_pidlFldr;
  111. ULONG m_uRegister;
  112. IShellView * m_pShellView;
  113. ITaskScheduler * m_pScheduler;
  114. LPTSTR m_pszMachine;
  115. LPCTSTR m_pszFolderPath;
  116. CDllRef m_DllRef;
  117. ULONG m_ulListViewModeOnEntry;
  118. //
  119. // Data used for drag drop
  120. //
  121. DWORD m_grfKeyStateLast;
  122. //
  123. // QCMINFO got during DVM_MERGEMENU and used during DVM_INVOKECOMMAND
  124. // in _JobsFVCallBack
  125. //
  126. QCMINFO m_qcm;
  127. //
  128. // data used by _OnUpdateDir
  129. //
  130. PBYTE m_pUpdateDirData;
  131. int m_cObjsAlloced;
  132. }; // class CJobFolder
  133. //____________________________________________________________________________
  134. //
  135. // Member: CJobFolder::CJobFolder, Constructor
  136. //____________________________________________________________________________
  137. inline
  138. CJobFolder::CJobFolder(void)
  139. :
  140. m_ulRefs(1),
  141. m_hwndOwner(NULL),
  142. m_hwndNotify(NULL),
  143. m_pidlFldr(NULL),
  144. m_uRegister(0),
  145. m_pShellView(NULL),
  146. m_pScheduler(NULL),
  147. m_pszMachine(NULL),
  148. m_pszFolderPath(NULL),
  149. m_pUpdateDirData(NULL),
  150. m_cObjsAlloced(0),
  151. m_ulListViewModeOnEntry(INVALID_LISTVIEW_STYLE)
  152. {
  153. TRACE(CJobFolder, CJobFolder);
  154. }
  155. //____________________________________________________________________________
  156. //
  157. // Member: CJobFolder::_InitRest
  158. //
  159. // Returns: HRESULT
  160. //
  161. // History: 2/20/1996 RaviR Created
  162. //
  163. //____________________________________________________________________________
  164. inline
  165. HRESULT
  166. CJobFolder::_InitRest(void)
  167. {
  168. TRACE(CJobFolder, _InitRest);
  169. // Get the scheduler & cache it
  170. return JFGetJobScheduler(m_pszMachine, &m_pScheduler, &m_pszFolderPath);
  171. }
  172. #endif // __JOBFLDR_HXX__