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.

211 lines
5.7 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1996.
  5. //
  6. // File: finish.cxx
  7. //
  8. // Contents: Task wizard Onestop finish property page implementation.
  9. //
  10. // Classes: CFinishPage
  11. //
  12. // History: 11-21-1998 SusiA
  13. //
  14. //---------------------------------------------------------------------------
  15. #include "precomp.h"
  16. CFinishPage *g_pFinishPage = NULL;
  17. extern CSelectItemsPage *g_pSelectItemsPage;
  18. //+-------------------------------------------------------------------------------
  19. // FUNCTION: SchedWizardFinishDlgProc(HWND, UINT, WPARAM, LPARAM)
  20. //
  21. // PURPOSE: Callback dialog procedure for the property page
  22. //
  23. // PARAMETERS:
  24. // hDlg - Dialog box window handle
  25. // uMessage - current message
  26. // wParam - depends on message
  27. // lParam - depends on message
  28. //
  29. // RETURN VALUE:
  30. //
  31. // Depends on message. In general, return TRUE if we process it.
  32. //
  33. // COMMENTS:
  34. //
  35. //--------------------------------------------------------------------------------
  36. INT_PTR CALLBACK SchedWizardFinishDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
  37. {
  38. WORD wNotifyCode = HIWORD(wParam); // notification code
  39. switch (uMessage)
  40. {
  41. case WM_INITDIALOG:
  42. if (g_pFinishPage)
  43. g_pFinishPage->Initialize(hDlg);
  44. InitPage(hDlg,lParam);
  45. break;
  46. case WM_PAINT:
  47. WmPaint(hDlg, uMessage, wParam, lParam);
  48. break;
  49. case WM_PALETTECHANGED:
  50. WmPaletteChanged(hDlg, wParam);
  51. break;
  52. case WM_QUERYNEWPALETTE:
  53. return( WmQueryNewPalette(hDlg) );
  54. break;
  55. case WM_ACTIVATE:
  56. return( WmActivate(hDlg, wParam, lParam) );
  57. break;
  58. case WM_COMMAND:
  59. break;
  60. case WM_NOTIFY:
  61. switch (((NMHDR FAR *) lParam)->code)
  62. {
  63. case PSN_KILLACTIVE:
  64. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
  65. break;
  66. case PSN_RESET:
  67. // reset to the original values
  68. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
  69. break;
  70. case PSN_SETACTIVE:
  71. g_pFinishPage->OnPSNSetActive(lParam);
  72. break;
  73. case PSN_WIZFINISH:
  74. {
  75. if (g_pSelectItemsPage)
  76. {
  77. if (S_OK != g_pSelectItemsPage->CommitChanges())
  78. {
  79. SchedUIErrorDialog(hDlg, IERR_SCHEDULE_SAVE_FAIL);
  80. }
  81. }
  82. }
  83. break;
  84. default:
  85. return FALSE;
  86. }
  87. break;
  88. default:
  89. return FALSE;
  90. }
  91. return TRUE;
  92. }
  93. //+--------------------------------------------------------------------------
  94. //
  95. // Member: CFinishPage::CFinishPage
  96. //
  97. // Synopsis: Initialize the finish page
  98. //
  99. // [phPSP] - filled with prop page handle
  100. //
  101. // History: 11-21-1998 SusiA
  102. //
  103. //---------------------------------------------------------------------------
  104. CFinishPage::CFinishPage(
  105. HINSTANCE hinst,
  106. ISyncSchedule *pISyncSched,
  107. HPROPSHEETPAGE *phPSP)
  108. {
  109. ZeroMemory(&m_psp, sizeof(m_psp));
  110. m_psp.dwSize = sizeof (PROPSHEETPAGE);
  111. m_psp.hInstance = hinst;
  112. m_psp.dwFlags = PSP_DEFAULT;
  113. m_psp.pszTemplate = MAKEINTRESOURCE(IDD_SCHEDWIZ_FINISH);
  114. m_psp.pszIcon = NULL;
  115. m_psp.pfnDlgProc = SchedWizardFinishDlgProc;
  116. m_psp.lParam = 0;
  117. m_pISyncSched = pISyncSched;
  118. m_pISyncSched->AddRef();
  119. g_pFinishPage = this;
  120. *phPSP = CreatePropertySheetPage(&m_psp);
  121. }
  122. //+--------------------------------------------------------------------------
  123. //
  124. // Member: CFinishPage::Initialize(HWND hwnd)
  125. //
  126. // Synopsis: initialize the welcome page and set the task name to a unique
  127. // new onestop name
  128. //
  129. // History: 11-21-1998 SusiA
  130. //
  131. //---------------------------------------------------------------------------
  132. BOOL CFinishPage::Initialize(HWND hwnd)
  133. {
  134. m_hwnd = hwnd;
  135. HWND hwndName = GetDlgItem(hwnd,IDC_SCHED_NAME);
  136. LONG_PTR dwStyle = GetWindowLongPtr(hwndName, GWL_STYLE);
  137. SetWindowLongPtr(hwndName, GWL_STYLE, dwStyle | SS_ENDELLIPSIS);
  138. return TRUE;
  139. }
  140. //+--------------------------------------------------------------------------
  141. //
  142. // Member: CFinishPage::OnPSNSetActive(LPARAM lParam)
  143. //
  144. // Synopsis: handle the set active notification
  145. //
  146. // History: 12-08-1998 SusiA
  147. //
  148. //---------------------------------------------------------------------------
  149. BOOL CFinishPage::OnPSNSetActive(LPARAM lParam)
  150. {
  151. HRESULT hr;
  152. LPWSTR pwszTrigger = NULL;
  153. WCHAR pwszSchedName[MAX_PATH + 1];
  154. DWORD dwSize = MAX_PATH;
  155. PropSheet_SetWizButtons(GetParent(m_hwnd), PSWIZB_BACK | PSWIZB_FINISH);
  156. //Schedule Name
  157. if (FAILED(hr = m_pISyncSched->GetScheduleName(&dwSize, pwszSchedName)))
  158. {
  159. return FALSE;
  160. }
  161. SetStaticString(GetDlgItem(m_hwnd,IDC_SCHED_NAME), pwszSchedName);
  162. ITaskTrigger *pTrigger;
  163. if (FAILED(hr = m_pISyncSched->GetTrigger(&pTrigger)))
  164. {
  165. return FALSE;
  166. }
  167. if (FAILED(hr = pTrigger ->GetTriggerString(&pwszTrigger)))
  168. {
  169. return FALSE;
  170. }
  171. Static_SetText(GetDlgItem(m_hwnd,IDC_ScheduleTime), pwszTrigger);
  172. return TRUE;
  173. }