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.

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