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.

105 lines
2.7 KiB

  1. // WmiPropertyBrowseDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "snapin.h"
  5. #include "WmiPropertyBrowseDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CWmiPropertyBrowseDlg dialog
  13. CWmiPropertyBrowseDlg::CWmiPropertyBrowseDlg(CWnd* pParent /*=NULL*/)
  14. : CResizeableDialog(CWmiPropertyBrowseDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CWmiPropertyBrowseDlg)
  17. m_sTitle = _T("");
  18. //}}AFX_DATA_INIT
  19. }
  20. void CWmiPropertyBrowseDlg::DoDataExchange(CDataExchange* pDX)
  21. {
  22. CResizeableDialog::DoDataExchange(pDX);
  23. //{{AFX_DATA_MAP(CWmiPropertyBrowseDlg)
  24. DDX_Control(pDX, IDC_LIST_WMI_ITEMS, m_Items);
  25. DDX_Text(pDX, IDC_STATIC_TITLE, m_sTitle);
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(CWmiPropertyBrowseDlg, CResizeableDialog)
  29. //{{AFX_MSG_MAP(CWmiPropertyBrowseDlg)
  30. ON_BN_CLICKED(IDC_BUTTON_HELP, OnButtonHelp)
  31. //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CWmiPropertyBrowseDlg message handlers
  35. BOOL CWmiPropertyBrowseDlg::OnInitDialog()
  36. {
  37. CResizeableDialog::OnInitDialog();
  38. CWaitCursor wait;
  39. // set the extended styles for the list control
  40. m_Items.SetExtendedStyle(LVS_EX_LABELTIP|LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP);
  41. SetControlInfo(IDC_STATIC_TITLE, ANCHOR_LEFT | ANCHOR_TOP | RESIZE_HOR);
  42. SetControlInfo(IDC_LIST_WMI_ITEMS, ANCHOR_LEFT | ANCHOR_TOP | RESIZE_HOR | RESIZE_VER);
  43. SetControlInfo(IDOK, ANCHOR_BOTTOM | ANCHOR_LEFT );
  44. SetControlInfo(IDCANCEL, ANCHOR_BOTTOM | ANCHOR_LEFT );
  45. SetControlInfo(IDC_BUTTON_HELP,ANCHOR_BOTTOM | ANCHOR_LEFT );
  46. SetWindowText(m_sDlgTitle);
  47. CString sColName;
  48. sColName.LoadString(IDS_STRING_NAME);
  49. m_Items.InsertColumn(0,sColName);
  50. sColName.LoadString(IDS_STRING_TYPE);
  51. m_Items.InsertColumn(1,sColName);
  52. CStringArray saNames;
  53. m_ClassObject.GetPropertyNames(saNames);
  54. for( int i = 0; i < saNames.GetSize(); i++ )
  55. {
  56. CString sType;
  57. int iItemIndex = m_Items.InsertItem(i,saNames[i]);
  58. m_ClassObject.GetPropertyType(saNames[i],sType);
  59. m_Items.SetItem(iItemIndex,1,LVIF_TEXT,sType,-1,-1,-1,0L);
  60. m_Items.SetColumnWidth(0,LVSCW_AUTOSIZE);
  61. m_Items.SetColumnWidth(1,LVSCW_AUTOSIZE);
  62. }
  63. return TRUE; // return TRUE unless you set the focus to a control
  64. // EXCEPTION: OCX Property Pages should return FALSE
  65. }
  66. void CWmiPropertyBrowseDlg::OnOK()
  67. {
  68. POSITION pos = m_Items.GetFirstSelectedItemPosition();
  69. while( pos != NULL )
  70. {
  71. int iItemIndex = m_Items.GetNextSelectedItem(pos);
  72. m_saProperties.Add(m_Items.GetItemText(iItemIndex,0));
  73. }
  74. CResizeableDialog::OnOK();
  75. }
  76. void CWmiPropertyBrowseDlg::OnButtonHelp()
  77. {
  78. // TODO: Add your control notification handler code here
  79. }