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.

113 lines
2.3 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. // NewPropDlg.cpp : implementation file
  8. //
  9. #include "stdafx.h"
  10. #include "wmitest.h"
  11. #include "NewPropDlg.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CNewPropDlg dialog
  19. CNewPropDlg::CNewPropDlg(CWnd* pParent /*=NULL*/)
  20. : CDialog(CNewPropDlg::IDD, pParent)
  21. {
  22. //{{AFX_DATA_INIT(CNewPropDlg)
  23. m_strName = _T("");
  24. //}}AFX_DATA_INIT
  25. }
  26. #define IDS_FIRST_TYPE IDS_CIM_SINT8
  27. #define IDS_LAST_TYPE IDS_CIM_OBJECT
  28. static DWORD dwTypes[] =
  29. {
  30. CIM_SINT8,
  31. CIM_UINT8,
  32. CIM_SINT16,
  33. CIM_UINT16,
  34. CIM_SINT32,
  35. CIM_UINT32,
  36. CIM_SINT64,
  37. CIM_UINT64,
  38. CIM_REAL32,
  39. CIM_REAL64,
  40. CIM_BOOLEAN,
  41. CIM_STRING,
  42. CIM_DATETIME,
  43. CIM_REFERENCE,
  44. CIM_CHAR16,
  45. CIM_OBJECT,
  46. };
  47. void CNewPropDlg::DoDataExchange(CDataExchange* pDX)
  48. {
  49. CDialog::DoDataExchange(pDX);
  50. //{{AFX_DATA_MAP(CNewPropDlg)
  51. DDX_Control(pDX, IDC_TYPE, m_ctlTypes);
  52. DDX_Text(pDX, IDC_NAME, m_strName);
  53. //}}AFX_DATA_MAP
  54. if (!pDX->m_bSaveAndValidate)
  55. {
  56. CString strType;
  57. for (int i = IDS_FIRST_TYPE; i <= IDS_LAST_TYPE; i++)
  58. {
  59. int iWhere;
  60. strType.LoadString(i);
  61. iWhere = m_ctlTypes.AddString(strType);
  62. m_ctlTypes.SetItemData(iWhere, dwTypes[i - IDS_FIRST_TYPE]);
  63. }
  64. // Select CIM_STRING as our default type.
  65. strType.LoadString(IDS_CIM_STRING);
  66. m_ctlTypes.SelectString(-1, strType);
  67. // Make OK disabled until we get a property name.
  68. GetDlgItem(IDOK)->EnableWindow(FALSE);
  69. }
  70. else
  71. {
  72. m_type = m_ctlTypes.GetItemData(m_ctlTypes.GetCurSel());
  73. if (IsDlgButtonChecked(IDC_ARRAY))
  74. m_type |= CIM_FLAG_ARRAY;
  75. }
  76. }
  77. BEGIN_MESSAGE_MAP(CNewPropDlg, CDialog)
  78. //{{AFX_MSG_MAP(CNewPropDlg)
  79. ON_EN_CHANGE(IDC_NAME, OnChangeName)
  80. //}}AFX_MSG_MAP
  81. END_MESSAGE_MAP()
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CNewPropDlg message handlers
  84. void CNewPropDlg::OnChangeName()
  85. {
  86. GetDlgItem(IDOK)->EnableWindow(
  87. SendDlgItemMessage(IDC_NAME, WM_GETTEXTLENGTH, 0, 0) != 0);
  88. }