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.

149 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. einfodlg.cpp
  5. Abstract:
  6. Author:
  7. Sivaprasad Padisetty (sivapad) 6/25/97
  8. Revision History:
  9. --*/
  10. #include "stdafx.h"
  11. #include "evtview.h"
  12. #include "EInfodlg.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CScheduleEventInfo dialog
  20. CScheduleEventInfo::CScheduleEventInfo(CWnd* pParent /*=NULL*/)
  21. : CDialog(CScheduleEventInfo::IDD, pParent)
  22. {
  23. //{{AFX_DATA_INIT(CScheduleEventInfo)
  24. m_stSourceName = _T("");
  25. m_stSCatagory = _T("");
  26. m_stSFilter = _T("");
  27. m_stSSourceName = _T("");
  28. m_stSSubFilter = _T("");
  29. m_stSObjectName = _T("");
  30. m_stObjectName = _T("");
  31. //}}AFX_DATA_INIT
  32. }
  33. void CScheduleEventInfo::DoDataExchange(CDataExchange* pDX)
  34. {
  35. CDialog::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(CScheduleEventInfo)
  37. DDX_Control(pDX, IDC_CATAGORY, m_ctrlCatagory);
  38. DDX_Control(pDX, IDC_SUBFILTER, m_ctrlSubFilter);
  39. DDX_Control(pDX, IDC_FILTER, m_ctrlFilter);
  40. DDX_Text(pDX, IDC_SOURCENAME, m_stSourceName);
  41. DDX_Text(pDX, IDC_SCATAGORY, m_stSCatagory);
  42. DDX_Text(pDX, IDC_SFILTER, m_stSFilter);
  43. DDX_Text(pDX, IDC_SSOURCENAME, m_stSSourceName);
  44. DDX_Text(pDX, IDC_SSUBFILTER, m_stSSubFilter);
  45. DDX_Text(pDX, IDC_SOBJECTNAME, m_stSObjectName);
  46. DDX_Text(pDX, IDC_OBJECTNAME, m_stObjectName);
  47. //}}AFX_DATA_MAP
  48. }
  49. BEGIN_MESSAGE_MAP(CScheduleEventInfo, CDialog)
  50. //{{AFX_MSG_MAP(CScheduleEventInfo)
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CScheduleEventInfo message handlers
  55. void CScheduleEventInfo::OnOK()
  56. {
  57. UpdateData (TRUE) ;
  58. sEventInfo.dwCatagory = m_ctrlCatagory.GetItemData (m_ctrlCatagory.GetCurSel()) ;
  59. sEventInfo.dwFilter = m_ctrlFilter.GetItemData (m_ctrlFilter.GetCurSel()) ;
  60. sEventInfo.dwSubFilter = m_ctrlSubFilter.GetItemData (m_ctrlSubFilter.GetCurSel()) ;
  61. wcscpy (sEventInfo.szSourceName, m_stSourceName) ;
  62. wcscpy (sEventInfo.szObjectName, m_stObjectName) ;
  63. CDialog::OnOK();
  64. }
  65. void CScheduleEventInfo::InitializeFilter ()
  66. {
  67. ULONG_PTR dwCatagory = m_ctrlCatagory.GetItemData (m_ctrlCatagory.GetCurSel ()) ;
  68. ASSERT (dwCatagory != CB_ERR) ;
  69. PEVENTDEFINITION pEvtDef = GetEventDefinition (dwCatagory) ;
  70. PDWORDTOSTRINGMAP pTypeMap ;
  71. pTypeMap = pEvtDef->pFilter ;
  72. int i = 0;
  73. while (pTypeMap [i].pszDesc)
  74. {
  75. // BUBBUG No Idea why this works and the other crashes.
  76. CString st = pTypeMap [i].pszDesc ;
  77. m_ctrlFilter.AddString (st) ;
  78. // m_ctrlFilter.AddString (pTypeMap [i].pszDesc) ;
  79. m_ctrlFilter.SetItemData (i, pTypeMap [i].dwCode) ;
  80. i++ ;
  81. }
  82. if (i)
  83. m_ctrlFilter.SetCurSel (0) ;
  84. }
  85. BOOL CScheduleEventInfo::OnInitDialog()
  86. {
  87. CDialog::OnInitDialog();
  88. POSITION pos = ptrlstEventDef.GetHeadPosition () ;
  89. PEVENTDEFINITION pEvtDef ;
  90. int i = 0;
  91. while (pos)
  92. {
  93. pEvtDef = (PEVENTDEFINITION) ptrlstEventDef.GetNext (pos) ;
  94. m_ctrlCatagory.AddString (pEvtDef->szCatagory) ;
  95. m_ctrlCatagory.SetItemData (i, pEvtDef->dwCatagory) ;
  96. i ++ ;
  97. }
  98. m_ctrlCatagory.SetCurSel (0) ;
  99. m_stSCatagory = pEvtDef->szCatagory ;
  100. m_stSFilter = pEvtDef->szFilterPrompt ;
  101. m_stSSourceName = pEvtDef->szSourceNamePrompt ;
  102. m_stSSubFilter = pEvtDef->szSubFilterPrompt ;
  103. m_stSObjectName = pEvtDef->szObjectNamePrompt ;
  104. InitializeFilter () ;
  105. UpdateData (FALSE) ;
  106. return TRUE; // return TRUE unless you set the focus to a control
  107. // EXCEPTION: OCX Property Pages should return FALSE
  108. }