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.

246 lines
5.6 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1996.
  5. //
  6. // File: taskwiz.hxx
  7. //
  8. // Contents: Definition of create new task wizard
  9. //
  10. // Classes: CTaskWizard
  11. //
  12. // History: 5-05-1997 DavidMun Created
  13. //
  14. //---------------------------------------------------------------------------
  15. #ifndef __TASKWIZ_HXX_
  16. #define __TASKWIZ_HXX_
  17. //
  18. // Types
  19. //
  20. // TASK_WIZARD_PAGE - indexes into array of wizard pages in CTaskWizard
  21. //
  22. enum TASK_WIZARD_PAGE
  23. {
  24. TWP_WELCOME,
  25. TWP_SELECT_PROGRAM,
  26. TWP_SELECT_TRIGGER,
  27. TWP_DAILY,
  28. TWP_WEEKLY,
  29. TWP_MONTHLY,
  30. TWP_ONCE,
  31. #if !defined(_CHICAGO_)
  32. TWP_PASSWORD,
  33. #endif // !defined(_CHICAGO_)
  34. TWP_COMPLETION,
  35. NUM_TASK_WIZARD_PAGES
  36. };
  37. //
  38. // Syntactic sugar
  39. //
  40. #define GetWelcomePage(ptw) ((CWelcomePage *)ptw->GetPage(TWP_WELCOME))
  41. #define GetSelectProgramPage(ptw) ((CSelectProgramPage *)ptw->GetPage(TWP_SELECT_PROGRAM))
  42. #define GetSelectTriggerPage(ptw) ((CSelectTriggerPage *)ptw->GetPage(TWP_SELECT_TRIGGER))
  43. #define GetDailyPage(ptw) ((CDailyPage *)ptw->GetPage(TWP_DAILY))
  44. #define GetWeeklyPage(ptw) ((CWeeklyPage *)ptw->GetPage(TWP_WEEKLY))
  45. #define GetMonthlyPage(ptw) ((CMonthlyPage *)ptw->GetPage(TWP_MONTHLY))
  46. #define GetOncePage(ptw) ((COncePage *)ptw->GetPage(TWP_ONCE))
  47. #if !defined(_CHICAGO_)
  48. #define GetPasswordPage(ptw) ((CPasswordPage *)ptw->GetPage(TWP_PASSWORD))
  49. #endif // !defined(_CHICAGO_)
  50. #define GetCompletionPage(ptw) ((CCompletionPage *)ptw->GetPage(TWP_COMPLETION))
  51. //+--------------------------------------------------------------------------
  52. //
  53. // Class: CTaskWizard
  54. //
  55. // Purpose: Create and support the task wizard property sheet pages.
  56. //
  57. // History: 5-05-1997 DavidMun Created
  58. //
  59. //---------------------------------------------------------------------------
  60. class CTaskWizard
  61. {
  62. public:
  63. static HRESULT
  64. Launch(
  65. LPCTSTR ptszFolderPath,
  66. LPCITEMIDLIST pidlFolder);
  67. CWizPage *
  68. GetPage(
  69. TASK_WIZARD_PAGE twpWhich);
  70. VOID
  71. SetAdvancedMode(
  72. BOOL fAdvanced);
  73. VOID
  74. SetTaskObject(
  75. ITask *pTask);
  76. VOID
  77. SetJobObjectPath(
  78. LPCTSTR tszPath);
  79. private:
  80. //
  81. // Ctor is private to enforce Launch member as only way to
  82. // create an instance of this class.
  83. //
  84. CTaskWizard(
  85. LPCTSTR ptszFolderPath,
  86. LPITEMIDLIST pidlFolder);
  87. //
  88. // Dtor is private since object always destroys itself
  89. //
  90. ~CTaskWizard();
  91. //
  92. // Thread callback. Wizard must run in separate thread so explorer
  93. // function which invokes it (i.e., menu item or double click) isn't
  94. // stalled.
  95. //
  96. static DWORD WINAPI
  97. _WizardThreadProc(
  98. LPVOID pvThis);
  99. //
  100. // The thread proc calls this method to actually get the wizard going
  101. //
  102. HRESULT
  103. _DoWizard();
  104. //
  105. // Searches for an instance of the task wizard already open on the
  106. // focussed computer before opening a new one.
  107. //
  108. static HRESULT
  109. _FindWizard(
  110. LPCTSTR ptszTarget);
  111. //
  112. // Private data members
  113. //
  114. TCHAR _tszFolderPath[MAX_PATH + 1];
  115. LPITEMIDLIST _pidlFolder;
  116. CWizPage *_apWizPages[NUM_TASK_WIZARD_PAGES];
  117. #ifdef WIZARD97
  118. BOOL _fUse256ColorBmp;
  119. #endif // WIZARD97
  120. BOOL _fAdvanced;
  121. TCHAR _tszJobObjectFullPath[MAX_PATH + 1];
  122. ITask *_pTask;
  123. };
  124. //+--------------------------------------------------------------------------
  125. //
  126. // Member: CTaskWizard::GetPage
  127. //
  128. // Synopsis: Access function to return specified page object
  129. //
  130. // History: 5-19-1997 DavidMun Created
  131. //
  132. //---------------------------------------------------------------------------
  133. inline CWizPage *
  134. CTaskWizard::GetPage(
  135. TASK_WIZARD_PAGE twpWhich)
  136. {
  137. DEBUG_ASSERT(twpWhich >= TWP_WELCOME && twpWhich <= TWP_COMPLETION);
  138. return _apWizPages[twpWhich];
  139. }
  140. //+--------------------------------------------------------------------------
  141. //
  142. // Member: CTaskWizard::SetAdvancedMode
  143. //
  144. // Synopsis: Set/clear flag to invoke new task's property sheet on close.
  145. //
  146. // History: 5-19-1997 DavidMun Created
  147. //
  148. //---------------------------------------------------------------------------
  149. inline VOID
  150. CTaskWizard::SetAdvancedMode(
  151. BOOL fAdvanced)
  152. {
  153. _fAdvanced = fAdvanced;
  154. }
  155. //+--------------------------------------------------------------------------
  156. //
  157. // Member: CTaskWizard::SetTaskObject
  158. //
  159. // Synopsis: Hold on to a task object's ITask pointer.
  160. //
  161. // History: 5-19-1997 DavidMun Created
  162. //
  163. // Notes: Caller addref'd [pTask] for us. It will be released in dtor.
  164. //
  165. //---------------------------------------------------------------------------
  166. inline VOID
  167. CTaskWizard::SetTaskObject(
  168. ITask *pTask)
  169. {
  170. DEBUG_ASSERT(!_pTask);
  171. DEBUG_ASSERT(pTask);
  172. _pTask = pTask;
  173. }
  174. //+--------------------------------------------------------------------------
  175. //
  176. // Member: CTaskWizard::SetJobObjectPath
  177. //
  178. // Synopsis: Records the full path to the new .job object.
  179. //
  180. // History: 5-19-1997 DavidMun Created
  181. //
  182. // Notes: This is called by the finish page if we'll need to supply
  183. // the path to the property sheet.
  184. //
  185. //---------------------------------------------------------------------------
  186. inline VOID
  187. CTaskWizard::SetJobObjectPath(
  188. LPCTSTR tszPath)
  189. {
  190. lstrcpyn(_tszJobObjectFullPath, tszPath, ARRAYLEN(_tszJobObjectFullPath));
  191. }
  192. #endif // __TASKWIZ_HXX_