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.

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