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.

168 lines
4.4 KiB

  1. //+---------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1993 - 1997.
  5. //
  6. // File: cnfgpsht.cpp
  7. //
  8. // Contents: Implements class COlecnfgPropertySheet
  9. //
  10. // Classes:
  11. //
  12. // Methods: COlecnfgPropertySheet::COlecnfgPropertySheet
  13. // COlecnfgPropertySheet::~COlecnfgPropertySheet
  14. // COlecnfgPropertySheet::DoModal
  15. // COlecnfgPropertySheet::Create
  16. // COlecnfgPropertySheet::OnNcCreate
  17. // COlecnfgPropertySheet::OnCommand
  18. //
  19. // History: 23-Apr-96 BruceMa Created.
  20. //
  21. //----------------------------------------------------------------------
  22. #include "stdafx.h"
  23. #include "afxtempl.h"
  24. #include "resource.h"
  25. #include "cstrings.h"
  26. #include "creg.h"
  27. #include "types.h"
  28. #include "datapkt.h"
  29. #if !defined(STANDALONE_BUILD)
  30. extern "C"
  31. {
  32. #include <getuser.h>
  33. }
  34. #endif
  35. #include "util.h"
  36. #include "virtreg.h"
  37. #include "CnfgPSht.h"
  38. #ifdef _DEBUG
  39. #define new DEBUG_NEW
  40. #undef THIS_FILE
  41. static char BASED_CODE THIS_FILE[] = __FILE__;
  42. #endif
  43. /////////////////////////////////////////////////////////////////////////////
  44. // COlecnfgPropertySheet
  45. IMPLEMENT_DYNAMIC(COlecnfgPropertySheet, CPropertySheet)
  46. COlecnfgPropertySheet::COlecnfgPropertySheet(CWnd* pWndParent)
  47. : CPropertySheet(IDS_PROPSHT_CAPTION, pWndParent)
  48. {
  49. // Set the title
  50. CString sTitle;
  51. sTitle.LoadString(IDS_PSMAIN_TITLE);
  52. SetTitle(sTitle, PSH_PROPTITLE);
  53. // Add all of the property pages here. Note that
  54. // the order that they appear in here will be
  55. // the order they appear in on screen. By default,
  56. // the first page of the set is the active one.
  57. // One way to make a different property page the
  58. // active one is to call SetActivePage().
  59. // Disable property sheet help button
  60. m_psh.dwFlags &= ~PSH_HASHELP;
  61. m_Page1.m_psp.dwFlags &= ~PSH_HASHELP;
  62. m_Page2.m_psp.dwFlags &= ~PSH_HASHELP;
  63. m_Page3.m_psp.dwFlags &= ~PSH_HASHELP;
  64. m_Page4.m_psp.dwFlags &= ~PSH_HASHELP;
  65. AddPage(&m_Page1);
  66. AddPage(&m_Page2);
  67. AddPage(&m_Page3);
  68. AddPage(&m_Page4);
  69. }
  70. COlecnfgPropertySheet::~COlecnfgPropertySheet()
  71. {
  72. }
  73. BEGIN_MESSAGE_MAP(COlecnfgPropertySheet, CPropertySheet)
  74. //{{AFX_MSG_MAP(COlecnfgPropertySheet)
  75. ON_WM_NCCREATE()
  76. ON_WM_DESTROY()
  77. //}}AFX_MSG_MAP
  78. END_MESSAGE_MAP()
  79. /////////////////////////////////////////////////////////////////////////////
  80. // COlecnfgPropertySheet message handlers
  81. INT_PTR COlecnfgPropertySheet::DoModal()
  82. {
  83. return CPropertySheet::DoModal();
  84. }
  85. BOOL COlecnfgPropertySheet::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
  86. {
  87. return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
  88. }
  89. BOOL COlecnfgPropertySheet::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
  90. {
  91. if (!CPropertySheet::OnNcCreate(lpCreateStruct))
  92. return FALSE;
  93. // Enable context help
  94. ModifyStyleEx(0, WS_EX_CONTEXTHELP);
  95. return TRUE;
  96. }
  97. BOOL COlecnfgPropertySheet::OnCommand(WPARAM wParam, LPARAM lParam)
  98. {
  99. // TODO: Add your specialized code here and/or call the base class
  100. switch (LOWORD(wParam))
  101. {
  102. case IDOK:
  103. case ID_APPLY_NOW:
  104. g_virtreg.ApplyAll();
  105. // Check whether the user changed something that requires a notification to DCOM
  106. if (g_fReboot)
  107. {
  108. g_util.UpdateDCOMInfo();
  109. // With the above interface to the SCM we don't have to ask the
  110. // user whether to reboot. However, I'll keep the code for
  111. // posterity.
  112. /*
  113. CString sCaption;
  114. CString sMessage;
  115. sCaption.LoadString(IDS_SYSTEMMESSAGE);
  116. sMessage.LoadString(IDS_REBOOT);
  117. if (MessageBox(sMessage, sCaption, MB_YESNO) == IDYES)
  118. {
  119. if (g_util.AdjustPrivilege(SE_SHUTDOWN_NAME))
  120. {
  121. // Now reboot
  122. ExitWindowsEx(EWX_REBOOT, 0);
  123. }
  124. }
  125. */
  126. }
  127. break;
  128. }
  129. return CPropertySheet::OnCommand(wParam, lParam);
  130. }
  131. void COlecnfgPropertySheet::OnDestroy()
  132. {
  133. CPropertySheet::OnDestroy();
  134. }