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.

209 lines
4.9 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. /*++
  3. Copyright (C) Microsoft Corporation, 1998 - 1999
  4. Module Name:
  5. IASEnumerableEditorPage.cpp
  6. Abstract:
  7. Implementation file for the CIASPgEnumAttr class.
  8. Revision History:
  9. mmaguire 06/25/98 - revised Baogang Yao's original implementation
  10. --*/
  11. //////////////////////////////////////////////////////////////////////////////
  12. //////////////////////////////////////////////////////////////////////////////
  13. // BEGIN INCLUDES
  14. //
  15. // standard includes:
  16. //
  17. #include "Precompiled.h"
  18. //
  19. // where we can find declaration for main class in this file:
  20. //
  21. #include "IASEnumerableEditorPage.h"
  22. //
  23. // where we can find declarations needed in this file:
  24. //
  25. #include "IASHelper.h"
  26. //
  27. // END INCLUDES
  28. //////////////////////////////////////////////////////////////////////////////
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CIASPgEnumAttr property page
  31. IMPLEMENT_DYNCREATE(CIASPgEnumAttr, CHelpDialog)
  32. BEGIN_MESSAGE_MAP(CIASPgEnumAttr, CHelpDialog)
  33. //{{AFX_MSG_MAP(CIASPgEnumAttr)
  34. // ON_WM_CONTEXTMENU()
  35. // ON_WM_HELPINFO()
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. //////////////////////////////////////////////////////////////////////////////
  39. /*++
  40. CIASPgEnumAttr::CIASPgEnumAttr
  41. Constructor
  42. --*/
  43. //////////////////////////////////////////////////////////////////////////////
  44. CIASPgEnumAttr::CIASPgEnumAttr() : CHelpDialog(CIASPgEnumAttr::IDD)
  45. {
  46. TRACE_FUNCTION("CIASPgEnumAttr::CIASPgEnumAttr\n");
  47. //{{AFX_DATA_INIT(CIASPgEnumAttr)
  48. m_strAttrFormat = _T("");
  49. m_strAttrName = _T("");
  50. m_strAttrType = _T("");
  51. m_strAttrValue = _T("");
  52. //}}AFX_DATA_INIT
  53. }
  54. //////////////////////////////////////////////////////////////////////////////
  55. /*++
  56. CIASPgEnumAttr::~CIASPgEnumAttr
  57. --*/
  58. //////////////////////////////////////////////////////////////////////////////
  59. CIASPgEnumAttr::~CIASPgEnumAttr()
  60. {
  61. TRACE_FUNCTION("CIASPgEnumAttr::~CIASPgEnumAttr\n");
  62. }
  63. //////////////////////////////////////////////////////////////////////////////
  64. /*++
  65. CIASPgEnumAttr::DoDataExchange
  66. --*/
  67. //////////////////////////////////////////////////////////////////////////////
  68. void CIASPgEnumAttr::DoDataExchange(CDataExchange* pDX)
  69. {
  70. TRACE_FUNCTION("CIASPgEnumAttr::DoDataExchange\n");
  71. CHelpDialog::DoDataExchange(pDX);
  72. //{{AFX_DATA_MAP(CIASPgEnumAttr)
  73. DDX_Text(pDX, IDC_IAS_STATIC_ATTRFORMAT, m_strAttrFormat);
  74. DDX_Text(pDX, IDC_IAS_STATIC_ATTRNAME, m_strAttrName);
  75. DDX_Text(pDX, IDC_IAS_STATIC_ATTRTYPE, m_strAttrType);
  76. DDX_CBString(pDX, IDC_IAS_COMBO_ENUM_VALUES, m_strAttrValue);
  77. //}}AFX_DATA_MAP
  78. }
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CIASPgEnumAttr message handlers
  81. //////////////////////////////////////////////////////////////////////////////
  82. /*++
  83. CIASPgEnumAttr::OnInitDialog
  84. --*/
  85. //////////////////////////////////////////////////////////////////////////////
  86. BOOL CIASPgEnumAttr::OnInitDialog()
  87. {
  88. TRACE_FUNCTION("CIASPgEnumAttr::OnInitDialog");
  89. CHelpDialog::OnInitDialog();
  90. // Check for preconditions:
  91. _ASSERTE( m_spIASAttributeInfo != NULL );
  92. HRESULT hr;
  93. //
  94. // initialize the combo box
  95. //
  96. CComboBox *pcbValuesBox = (CComboBox *) GetDlgItem (IDC_IAS_COMBO_ENUM_VALUES);
  97. _ASSERTE( pcbValuesBox != NULL );
  98. CComQIPtr< IIASEnumerableAttributeInfo, &IID_IIASEnumerableAttributeInfo> spIASEnumerableAttributeInfo( m_spIASAttributeInfo );
  99. if( spIASEnumerableAttributeInfo == NULL )
  100. {
  101. ErrorTrace(ERROR_NAPMMC_IASATTR, "Cannot populate the combo box -- schema attribute was not enumerable.");
  102. throw E_NOINTERFACE;
  103. }
  104. long lCountEnumeration;
  105. hr = spIASEnumerableAttributeInfo->get_CountEnumerateDescription( & lCountEnumeration );
  106. if( FAILED( hr ) ) throw hr;
  107. for (long lIndex=0; lIndex < lCountEnumeration; lIndex++)
  108. {
  109. CComBSTR bstrTemp;
  110. hr = spIASEnumerableAttributeInfo->get_EnumerateDescription( lIndex, &bstrTemp );
  111. if( FAILED( hr ) ) throw hr;
  112. pcbValuesBox->AddString( bstrTemp );
  113. }
  114. // look for the value in the selection list, so we can pre-set the cur-sel item
  115. pcbValuesBox->SetCurSel(0);
  116. pcbValuesBox->SelectString(0, m_strAttrValue);
  117. return TRUE; // return TRUE unless you set the focus to a control
  118. // EXCEPTION: OCX Property Pages should return FALSE
  119. }
  120. //////////////////////////////////////////////////////////////////////////////
  121. /*++
  122. CIASPgEnumAttr::SetData
  123. --*/
  124. //////////////////////////////////////////////////////////////////////////////
  125. HRESULT CIASPgEnumAttr::SetData( IIASAttributeInfo *pIASAttributeInfo )
  126. {
  127. TRACE_FUNCTION("CIASPgEnumAttr::SetData\n");
  128. // Check for preconditions:
  129. _ASSERTE( pIASAttributeInfo != NULL );
  130. HRESULT hr = S_OK;
  131. // Store off some pointers.
  132. m_spIASAttributeInfo = pIASAttributeInfo;
  133. return hr;
  134. }