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.

133 lines
3.1 KiB

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