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.

247 lines
6.8 KiB

  1. /*++
  2. Copyright (C) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. alrtcmdd.cpp
  5. Abstract:
  6. Implementation of the alerts action command arguments dialog.
  7. --*/
  8. #include "stdafx.h"
  9. #include "alrtactp.h"
  10. #include "alrtcmdd.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. static ULONG
  17. s_aulHelpIds[] =
  18. {
  19. IDC_CMD_ARG_SINGLE_CHK, IDH_CMD_ARG_SINGLE_CHK,
  20. IDC_CMD_ARG_ALERT_CHK, IDH_CMD_ARG_ALERT_CHK,
  21. IDC_CMD_ARG_NAME_CHK, IDH_CMD_ARG_NAME_CHK,
  22. IDC_CMD_ARG_DATE_CHK, IDH_CMD_ARG_DATE_CHK,
  23. IDC_CMD_ARG_LIMIT_CHK, IDH_CMD_ARG_LIMIT_CHK,
  24. IDC_CMD_ARG_VALUE_CHK, IDH_CMD_ARG_VALUE_CHK,
  25. IDC_CMD_USER_TEXT_CHK, IDH_CMD_USER_TEXT_CHK,
  26. IDC_CMD_USER_TEXT_EDIT, IDH_CMD_USER_TEXT_EDIT,
  27. IDC_CMD_ARG_SAMPLE_DISPLAY, IDH_CMD_ARG_SAMPLE_DISPLAY,
  28. 0,0
  29. };
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CAlertCommandArgsDlg dialog
  32. CAlertCommandArgsDlg::CAlertCommandArgsDlg(CWnd* pParent)
  33. : CDialog(CAlertCommandArgsDlg::IDD, pParent),
  34. m_pAlertActionPage( NULL ),
  35. m_strSampleArgList ( L"" ),
  36. m_strAlertName ( L"" ),
  37. m_CmdArg_bAlertName ( FALSE ),
  38. m_CmdArg_bDateTime ( FALSE ),
  39. m_CmdArg_bLimitValue ( FALSE ),
  40. m_CmdArg_bCounterPath ( FALSE ),
  41. m_CmdArg_bSingleArg ( FALSE ),
  42. m_CmdArg_bMeasuredValue ( FALSE ),
  43. m_CmdArg_bUserText ( FALSE ),
  44. m_CmdArg_strUserText ( L"" )
  45. {
  46. // EnableAutomation();
  47. //{{AFX_DATA_INIT(CAlertCommandArgsDlg)
  48. //}}AFX_DATA_INIT
  49. }
  50. CAlertCommandArgsDlg::~CAlertCommandArgsDlg()
  51. {
  52. }
  53. void CAlertCommandArgsDlg::OnFinalRelease()
  54. {
  55. // When the last reference for an automation object is released
  56. // OnFinalRelease is called. The base class will automatically
  57. // deletes the object. Add additional cleanup required for your
  58. // object before calling the base class.
  59. CDialog::OnFinalRelease();
  60. }
  61. void CAlertCommandArgsDlg::DoDataExchange(CDataExchange* pDX)
  62. {
  63. CDialog::DoDataExchange(pDX);
  64. //{{AFX_DATA_MAP(CAlertCommandArgsDlg)
  65. DDX_Check(pDX, IDC_CMD_ARG_ALERT_CHK, m_CmdArg_bAlertName);
  66. DDX_Check(pDX, IDC_CMD_ARG_DATE_CHK, m_CmdArg_bDateTime);
  67. DDX_Check(pDX, IDC_CMD_ARG_LIMIT_CHK, m_CmdArg_bLimitValue);
  68. DDX_Check(pDX, IDC_CMD_ARG_NAME_CHK, m_CmdArg_bCounterPath);
  69. DDX_Check(pDX, IDC_CMD_ARG_SINGLE_CHK, m_CmdArg_bSingleArg);
  70. DDX_Check(pDX, IDC_CMD_ARG_VALUE_CHK, m_CmdArg_bMeasuredValue);
  71. DDX_Check(pDX, IDC_CMD_USER_TEXT_CHK, m_CmdArg_bUserText);
  72. DDX_Text(pDX, IDC_CMD_USER_TEXT_EDIT, m_CmdArg_strUserText);
  73. DDV_MaxChars(pDX, m_CmdArg_strUserText, MAX_PATH);
  74. DDX_Text(pDX, IDC_CMD_ARG_SAMPLE_DISPLAY, m_strSampleArgList);
  75. //}}AFX_DATA_MAP
  76. }
  77. BEGIN_MESSAGE_MAP(CAlertCommandArgsDlg, CDialog)
  78. //{{AFX_MSG_MAP(CAlertCommandArgsDlg)
  79. ON_BN_CLICKED(IDC_CMD_ARG_SINGLE_CHK, OnCmdArgSingleChk)
  80. ON_BN_CLICKED(IDC_CMD_ARG_ALERT_CHK, OnCmdArgAlertChk)
  81. ON_BN_CLICKED(IDC_CMD_ARG_NAME_CHK, OnCmdArgNameChk)
  82. ON_BN_CLICKED(IDC_CMD_ARG_DATE_CHK, OnCmdArgDateChk)
  83. ON_BN_CLICKED(IDC_CMD_ARG_LIMIT_CHK, OnCmdArgLimitChk)
  84. ON_BN_CLICKED(IDC_CMD_ARG_VALUE_CHK, OnCmdArgValueChk)
  85. ON_BN_CLICKED(IDC_CMD_USER_TEXT_CHK, OnCmdUserTextChk)
  86. ON_EN_CHANGE(IDC_CMD_USER_TEXT_EDIT, OnCmdArgUserTextEditChange)
  87. ON_WM_HELPINFO()
  88. ON_WM_CONTEXTMENU()
  89. //}}AFX_MSG_MAP
  90. END_MESSAGE_MAP()
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CAlertCommandArgsDlg message handlers
  93. BOOL CAlertCommandArgsDlg::OnInitDialog()
  94. {
  95. ResourceStateManager rsm;
  96. ASSERT ( NULL != m_pAlertActionPage );
  97. m_pAlertActionPage->MakeSampleArgList (
  98. m_strSampleArgList,
  99. m_CmdArg_bSingleArg,
  100. m_CmdArg_bAlertName,
  101. m_CmdArg_bDateTime,
  102. m_CmdArg_bCounterPath,
  103. m_CmdArg_bMeasuredValue,
  104. m_CmdArg_bLimitValue,
  105. m_CmdArg_bUserText,
  106. m_CmdArg_strUserText );
  107. CDialog::OnInitDialog();
  108. UpdateCmdActionBox();
  109. return FALSE; // return TRUE unless you set the focus to a control
  110. // EXCEPTION: OCX Property Pages should return FALSE
  111. }
  112. void CAlertCommandArgsDlg::OnOK()
  113. {
  114. UpdateData (TRUE);
  115. CDialog::OnOK();
  116. }
  117. void CAlertCommandArgsDlg::OnCmdArgSingleChk()
  118. {
  119. UpdateCmdActionBox ();
  120. }
  121. void CAlertCommandArgsDlg::OnCmdArgAlertChk()
  122. {
  123. UpdateCmdActionBox ();
  124. }
  125. void CAlertCommandArgsDlg::OnCmdArgNameChk()
  126. {
  127. UpdateCmdActionBox ();
  128. }
  129. void CAlertCommandArgsDlg::OnCmdArgDateChk()
  130. {
  131. UpdateCmdActionBox ();
  132. }
  133. void CAlertCommandArgsDlg::OnCmdArgLimitChk()
  134. {
  135. UpdateCmdActionBox ();
  136. }
  137. void CAlertCommandArgsDlg::OnCmdArgValueChk()
  138. {
  139. UpdateCmdActionBox ();
  140. }
  141. void CAlertCommandArgsDlg::OnCmdUserTextChk()
  142. {
  143. UpdateCmdActionBox ();
  144. }
  145. void CAlertCommandArgsDlg::OnCmdArgUserTextEditChange()
  146. {
  147. UpdateCmdActionBox ();
  148. }
  149. BOOL
  150. CAlertCommandArgsDlg::OnHelpInfo(HELPINFO* pHelpInfo)
  151. {
  152. ASSERT( NULL != m_pAlertActionPage );
  153. if ( pHelpInfo->iCtrlId >= IDC_CMD_ARG_FIRST_HELP_CTRL ||
  154. pHelpInfo->iCtrlId == IDOK ||
  155. pHelpInfo->iCtrlId == IDCANCEL) {
  156. InvokeWinHelp(WM_HELP, NULL, (LPARAM)pHelpInfo, m_pAlertActionPage->GetContextHelpFilePath(), s_aulHelpIds);
  157. }
  158. return TRUE;
  159. }
  160. void
  161. CAlertCommandArgsDlg::OnContextMenu(CWnd* pWnd, CPoint /* point */)
  162. {
  163. ASSERT( NULL != m_pAlertActionPage );
  164. InvokeWinHelp(WM_CONTEXTMENU, (WPARAM)(pWnd->m_hWnd), NULL, m_pAlertActionPage->GetContextHelpFilePath(), s_aulHelpIds);
  165. return;
  166. }
  167. // Helper functions
  168. void
  169. CAlertCommandArgsDlg::SetAlertActionPage( CAlertActionProp* pPage )
  170. {
  171. // The alert action page is not always the parent, so store a separate pointer
  172. m_pAlertActionPage = pPage;
  173. }
  174. void CAlertCommandArgsDlg::UpdateCmdActionBox ()
  175. {
  176. UpdateData(TRUE);
  177. ASSERT ( NULL != m_pAlertActionPage );
  178. m_pAlertActionPage->MakeSampleArgList (
  179. m_strSampleArgList,
  180. m_CmdArg_bSingleArg,
  181. m_CmdArg_bAlertName,
  182. m_CmdArg_bDateTime,
  183. m_CmdArg_bCounterPath,
  184. m_CmdArg_bMeasuredValue,
  185. m_CmdArg_bLimitValue,
  186. m_CmdArg_bUserText,
  187. m_CmdArg_strUserText );
  188. UpdateData(FALSE);
  189. SetControlState();
  190. }
  191. BOOL
  192. CAlertCommandArgsDlg::SetControlState()
  193. {
  194. (GetDlgItem(IDC_CMD_USER_TEXT_EDIT))->EnableWindow(m_CmdArg_bUserText);
  195. return TRUE;
  196. }