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.

95 lines
2.1 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation
  2. //
  3. // File: ExpressDHCPPage.cpp
  4. //
  5. // Synopsis: Defines the express DHCP page used in the
  6. // Express path for the CYS Wizard
  7. //
  8. // History: 02/08/2001 JeffJon Created
  9. #include "pch.h"
  10. #include "resource.h"
  11. #include "InstallationUnitProvider.h"
  12. #include "ExpressDHCPPage.h"
  13. #include "state.h"
  14. static PCWSTR EXPRESSDHCP_PAGE_HELP = L"cys.chm::/cys_configuring_first_server.htm";
  15. ExpressDHCPPage::ExpressDHCPPage()
  16. :
  17. CYSWizardPage(
  18. IDD_EXPRESS_DHCP_PAGE,
  19. IDS_EXPRESS_DHCP_TITLE,
  20. IDS_EXPRESS_DHCP_SUBTITLE,
  21. EXPRESSDHCP_PAGE_HELP)
  22. {
  23. LOG_CTOR(ExpressDHCPPage);
  24. }
  25. ExpressDHCPPage::~ExpressDHCPPage()
  26. {
  27. LOG_DTOR(ExpressDHCPPage);
  28. }
  29. void
  30. ExpressDHCPPage::OnInit()
  31. {
  32. LOG_FUNCTION(ExpressDHCPPage::OnInit);
  33. }
  34. bool
  35. ExpressDHCPPage::OnSetActive()
  36. {
  37. LOG_FUNCTION(ExpressDHCPPage::OnSetActive);
  38. Win::PropSheet_SetWizButtons(
  39. Win::GetParent(hwnd),
  40. PSWIZB_NEXT | PSWIZB_BACK);
  41. return true;
  42. }
  43. int
  44. ExpressDHCPPage::Validate()
  45. {
  46. LOG_FUNCTION(ExpressDHCPPage::Validate);
  47. int nextPage = -1;
  48. DWORD startAddress = 0;
  49. LRESULT startResult = Win::SendMessage(
  50. Win::GetDlgItem(hwnd, IDC_START_IPADDRESS),
  51. IPM_GETADDRESS,
  52. 0,
  53. (LPARAM)&startAddress);
  54. DWORD endAddress = 0;
  55. LRESULT endResult = Win::SendMessage(
  56. Win::GetDlgItem(hwnd, IDC_END_IPADDRESS),
  57. IPM_GETADDRESS,
  58. 0,
  59. (LPARAM)&endAddress);
  60. if (!startResult || !endResult)
  61. {
  62. String message = String::load(IDS_BOTH_IPADDRESS_REQUIRED);
  63. popup.Gripe(hwnd, IDC_START_IPADDRESS, message);
  64. nextPage = -1;
  65. }
  66. else
  67. {
  68. InstallationUnitProvider::GetInstance().GetDHCPInstallationUnit().SetStartIPAddress(startAddress);
  69. InstallationUnitProvider::GetInstance().GetDHCPInstallationUnit().SetEndIPAddress(endAddress);
  70. nextPage = IDD_FINISH_PAGE;
  71. }
  72. return nextPage;
  73. }