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.

152 lines
3.8 KiB

  1. // SysGeneralPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "snapin.h"
  5. #include "SysGeneralPage.h"
  6. #include "System.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CSysGeneralPage property page
  14. IMPLEMENT_DYNCREATE(CSysGeneralPage, CHMPropertyPage)
  15. CSysGeneralPage::CSysGeneralPage() : CHMPropertyPage(CSysGeneralPage::IDD)
  16. {
  17. EnableAutomation();
  18. //{{AFX_DATA_INIT(CSysGeneralPage)
  19. m_sName = _T("");
  20. m_sComment = _T("");
  21. m_sCreationDate = _T("");
  22. m_sDomain = _T("");
  23. m_sHMVersion = _T("");
  24. m_sModifiedDate = _T("");
  25. m_sOSInfo = _T("");
  26. m_sProcessor = _T("");
  27. m_sWmiVersion = _T("");
  28. //}}AFX_DATA_INIT
  29. CnxPropertyPageInit();
  30. m_sHelpTopic = _T("HMon21.chm::/dMSgen.htm");
  31. }
  32. CSysGeneralPage::~CSysGeneralPage()
  33. {
  34. }
  35. void CSysGeneralPage::OnFinalRelease()
  36. {
  37. // When the last reference for an automation object is released
  38. // OnFinalRelease is called. The base class will automatically
  39. // deletes the object. Add additional cleanup required for your
  40. // object before calling the base class.
  41. CHMPropertyPage::OnFinalRelease();
  42. }
  43. void CSysGeneralPage::DoDataExchange(CDataExchange* pDX)
  44. {
  45. CHMPropertyPage::DoDataExchange(pDX);
  46. //{{AFX_DATA_MAP(CSysGeneralPage)
  47. DDX_Text(pDX, IDC_EDIT_NAME, m_sName);
  48. DDX_Text(pDX, IDC_EDIT_COMMENT, m_sComment);
  49. DDX_Text(pDX, IDC_STATIC_CREATED, m_sCreationDate);
  50. DDX_Text(pDX, IDC_STATIC_DOMAIN, m_sDomain);
  51. DDX_Text(pDX, IDC_STATIC_HM_VERSION, m_sHMVersion);
  52. DDX_Text(pDX, IDC_STATIC_MODIFIED, m_sModifiedDate);
  53. DDX_Text(pDX, IDC_STATIC_OS, m_sOSInfo);
  54. DDX_Text(pDX, IDC_STATIC_PROCESSOR, m_sProcessor);
  55. DDX_Text(pDX, IDC_STATIC_WMI_VERSION, m_sWmiVersion);
  56. //}}AFX_DATA_MAP
  57. }
  58. BEGIN_MESSAGE_MAP(CSysGeneralPage, CHMPropertyPage)
  59. //{{AFX_MSG_MAP(CSysGeneralPage)
  60. ON_WM_DESTROY()
  61. //}}AFX_MSG_MAP
  62. END_MESSAGE_MAP()
  63. BEGIN_DISPATCH_MAP(CSysGeneralPage, CHMPropertyPage)
  64. //{{AFX_DISPATCH_MAP(CSysGeneralPage)
  65. // NOTE - the ClassWizard will add and remove mapping macros here.
  66. //}}AFX_DISPATCH_MAP
  67. END_DISPATCH_MAP()
  68. // Note: we add support for IID_ISysGeneralPage to support typesafe binding
  69. // from VBA. This IID must match the GUID that is attached to the
  70. // dispinterface in the .ODL file.
  71. // {C3F44E80-BA00-11D2-BD76-0000F87A3912}
  72. static const IID IID_ISysGeneralPage =
  73. { 0xc3f44e80, 0xba00, 0x11d2, { 0xbd, 0x76, 0x0, 0x0, 0xf8, 0x7a, 0x39, 0x12 } };
  74. BEGIN_INTERFACE_MAP(CSysGeneralPage, CHMPropertyPage)
  75. INTERFACE_PART(CSysGeneralPage, IID_ISysGeneralPage, Dispatch)
  76. END_INTERFACE_MAP()
  77. /////////////////////////////////////////////////////////////////////////////
  78. // CSysGeneralPage message handlers
  79. BOOL CSysGeneralPage::OnInitDialog()
  80. {
  81. // unmarshal connmgr
  82. CnxPropertyPageCreate();
  83. CHMPropertyPage::OnInitDialog();
  84. CSystem* pSystem = (CSystem*)GetObjectPtr();
  85. m_sName = pSystem->GetName();
  86. m_sComment = pSystem->GetComment();
  87. pSystem->GetCreateDateTime(m_sCreationDate);
  88. pSystem->GetModifiedDateTime(m_sModifiedDate);
  89. pSystem->GetWMIVersion(m_sWmiVersion);
  90. pSystem->GetHMAgentVersion(m_sHMVersion);
  91. // get the operating system info
  92. pSystem->GetOperatingSystemInfo(m_sOSInfo);
  93. // get the computer system info
  94. pSystem->GetComputerSystemInfo(m_sDomain,m_sProcessor);
  95. UpdateData(FALSE);
  96. return TRUE; // return TRUE unless you set the focus to a control
  97. // EXCEPTION: OCX Property Pages should return FALSE
  98. }
  99. void CSysGeneralPage::OnOK()
  100. {
  101. CHMPropertyPage::OnOK();
  102. }
  103. void CSysGeneralPage::OnDestroy()
  104. {
  105. CHMPropertyPage::OnDestroy();
  106. CnxPropertyPageDestroy();
  107. }
  108. BOOL CSysGeneralPage::OnApply()
  109. {
  110. if( ! CHMPropertyPage::OnApply() )
  111. {
  112. return FALSE;
  113. }
  114. UpdateData();
  115. GetObjectPtr()->Rename(m_sName);
  116. GetObjectPtr()->UpdateComment(m_sComment);
  117. SetModified(FALSE);
  118. return TRUE;
  119. }