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.

181 lines
3.6 KiB

  1. // Copyright (c) 2002 Microsoft Corporation
  2. //
  3. // File: MilestonePage.cpp
  4. //
  5. // Synopsis: Defines the Milestone Page for the CYS
  6. // wizard
  7. //
  8. // History: 01/15/2002 JeffJon Created
  9. #include "pch.h"
  10. #include "resource.h"
  11. #include "InstallationUnitProvider.h"
  12. #include "MilestonePage.h"
  13. static PCWSTR MILESTONE_PAGE_HELP = L"cys.chm::/cys_milestone.htm";
  14. MilestonePage::MilestonePage()
  15. :
  16. needKillSelection(true),
  17. CYSWizardPage(
  18. IDD_MILESTONE_PAGE,
  19. IDS_MILESTONE_TITLE,
  20. IDS_MILESTONE_SUBTITLE,
  21. MILESTONE_PAGE_HELP,
  22. true,
  23. true)
  24. {
  25. LOG_CTOR(MilestonePage);
  26. }
  27. MilestonePage::~MilestonePage()
  28. {
  29. LOG_DTOR(MilestonePage);
  30. }
  31. void
  32. MilestonePage::OnInit()
  33. {
  34. LOG_FUNCTION(MilestonePage::OnInit);
  35. CYSWizardPage::OnInit();
  36. }
  37. bool
  38. MilestonePage::OnSetActive()
  39. {
  40. LOG_FUNCTION(MilestonePage::OnSetActive);
  41. Win::PropSheet_SetWizButtons(
  42. Win::GetParent(hwnd),
  43. PSWIZB_NEXT | PSWIZB_BACK);
  44. // Get the finish text from the installation unit and put it in the finish box
  45. String message;
  46. bool changes =
  47. InstallationUnitProvider::GetInstance().GetCurrentInstallationUnit().GetMilestoneText(message);
  48. if (!changes)
  49. {
  50. message = String::load(IDS_FINISH_NO_CHANGES);
  51. }
  52. Win::SetDlgItemText(hwnd, IDC_MILESTONE_EDIT, message);
  53. if (!changes)
  54. {
  55. popup.MessageBox(
  56. hwnd,
  57. IDS_NO_CHANGES_MESSAGEBOX_TEXT,
  58. MB_OK | MB_ICONWARNING);
  59. }
  60. // Remove the selection of the edit box
  61. Win::SetFocus(
  62. Win::GetDlgItem(
  63. Win::GetParent(hwnd),
  64. Wizard::NEXT_BTN_ID));
  65. Win::Edit_SetSel(
  66. Win::GetDlgItem(
  67. hwnd,
  68. IDC_MILESTONE_EDIT),
  69. -1,
  70. 0);
  71. // Set the focus to the Next button so that enter works
  72. Win::PostMessage(
  73. Win::GetParent(hwnd),
  74. WM_NEXTDLGCTL,
  75. (WPARAM) Win::GetDlgItem(Win::GetParent(hwnd), Wizard::NEXT_BTN_ID),
  76. TRUE);
  77. return true;
  78. }
  79. bool
  80. MilestonePage::OnCommand(
  81. HWND windowFrom,
  82. unsigned controlIDFrom,
  83. unsigned code)
  84. {
  85. bool result = false;
  86. switch (controlIDFrom)
  87. {
  88. case IDC_MILESTONE_EDIT:
  89. if (code == EN_SETFOCUS &&
  90. needKillSelection)
  91. {
  92. Win::Edit_SetSel(windowFrom, -1, -1);
  93. needKillSelection = false;
  94. }
  95. break;
  96. default:
  97. break;
  98. }
  99. return result;
  100. }
  101. bool
  102. MilestonePage::OnHelp()
  103. {
  104. LOG_FUNCTION(MilestonePage::OnHelp);
  105. ShowHelp(
  106. InstallationUnitProvider::GetInstance().
  107. GetCurrentInstallationUnit().GetMilestonePageHelp());
  108. return true;
  109. }
  110. int
  111. MilestonePage::Validate()
  112. {
  113. LOG_FUNCTION(MilestonePage::Validate);
  114. Win::WaitCursor wait;
  115. int nextPage = -1;
  116. if (!InstallationUnitProvider::GetInstance().
  117. GetCurrentInstallationUnit().DoInstallerCheck(hwnd))
  118. {
  119. nextPage = IDD_PROGRESS_PAGE;
  120. // Set the subtitle of the progress page
  121. // since it is used both for installing and
  122. // uninstalling
  123. int pageIndex =
  124. Win::PropSheet_IdToIndex(
  125. Win::GetParent(hwnd),
  126. IDD_PROGRESS_PAGE);
  127. LOG(String::format(
  128. L"pageIndex = %1!d!",
  129. pageIndex));
  130. Win::PropSheet_SetHeaderSubTitle(
  131. hwnd,
  132. pageIndex,
  133. String::load(IDS_PROGRESS_SUBTITLE));
  134. }
  135. LOG(String::format(
  136. L"nextPage = %1!d!",
  137. nextPage));
  138. return nextPage;
  139. }