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.6 KiB

  1. //
  2. //
  3. //
  4. #include "stdafx.h"
  5. #include "aspmain.h"
  6. LRESULT
  7. CAspMainPage::OnInitDialog(HWND hDlg, LPARAM lParam)
  8. {
  9. DoDataExchange();
  10. UDACCEL toAcc[3] = {{1, 1}, {3, 5}, {6, 10}};
  11. m_TimeoutSpin.SetRange32(SESSION_TIMEOUT_MIN, SESSION_TIMEOUT_MAX);
  12. m_TimeoutSpin.SetPos32(m_pData->m_SessionTimeout);
  13. m_TimeoutSpin.SetAccel(3, toAcc);
  14. m_AspTimeoutSpin.SetRange32(SCRIPT_TIMEOUT_MIN, SCRIPT_TIMEOUT_MAX);
  15. m_AspTimeoutSpin.SetPos32(m_pData->m_ScriptTimeout);
  16. m_AspTimeoutSpin.SetAccel(3, toAcc);
  17. BOOL bEnable = SendDlgItemMessage(IDC_ENABLE_SESSION, BM_GETCHECK, 0, 0);
  18. ::EnableWindow(GetDlgItem(IDC_SESSION_TIMEOUT), bEnable);
  19. ::EnableWindow(GetDlgItem(IDC_TIMEOUT_SPIN), bEnable);
  20. return FALSE;
  21. }
  22. void
  23. CAspMainPage::OnEnableSession(UINT nCode, UINT nID, HWND hWnd)
  24. {
  25. BOOL bEnable = SendDlgItemMessage(IDC_ENABLE_SESSION, BM_GETCHECK, 0, 0);
  26. ::EnableWindow(GetDlgItem(IDC_SESSION_TIMEOUT), bEnable);
  27. ::EnableWindow(GetDlgItem(IDC_TIMEOUT_SPIN), bEnable);
  28. SET_MODIFIED(TRUE);
  29. }
  30. BOOL
  31. CAspMainPage::OnKillActive()
  32. {
  33. BOOL res = FALSE;
  34. if (DoDataExchange(TRUE))
  35. {
  36. res = SUCCEEDED(m_pData->Save());
  37. }
  38. return res;
  39. }
  40. void
  41. CAspMainPage::OnDataValidateError(UINT id, BOOL bSave,_XData& data)
  42. {
  43. if (bSave)
  44. {
  45. CString str, fmt, caption;
  46. caption.LoadString(_Module.GetResourceInstance(), IDS_SHEET_TITLE);
  47. switch (data.nDataType)
  48. {
  49. case ddxDataNull:
  50. break;
  51. case ddxDataText:
  52. break;
  53. case ddxDataInt:
  54. fmt.LoadString(_Module.GetResourceInstance(), IDS_ERR_INT_RANGE);
  55. str.Format(fmt, data.intData.nMin, data.intData.nMax);
  56. break;
  57. }
  58. if (!str.IsEmpty())
  59. {
  60. MessageBox(str, caption, MB_OK | MB_ICONEXCLAMATION);
  61. ::SetFocus(GetDlgItem(id));
  62. }
  63. }
  64. }
  65. void
  66. CAspMainPage::OnDataExchangeError(UINT nCtrlID, BOOL bSave)
  67. {
  68. if (bSave)
  69. {
  70. CString str, caption;
  71. caption.LoadString(_Module.GetResourceInstance(), IDS_SHEET_TITLE);
  72. // This is hack to make testers happy. Here we creating dependence on
  73. // dialog layout and range values
  74. if (nCtrlID == IDC_SESSION_TIMEOUT || nCtrlID == IDC_SCRIPT_TIMEOUT)
  75. {
  76. CString fmt;
  77. fmt.LoadString(_Module.GetResourceInstance(), IDS_ERR_INT_RANGE);
  78. str.Format(fmt, SESSION_TIMEOUT_MIN, SESSION_TIMEOUT_MAX);
  79. }
  80. else
  81. {
  82. str.LoadString(_Module.GetResourceInstance(), IDS_ERR_INVALID_DATA);
  83. }
  84. MessageBox(str, caption, MB_OK | MB_ICONEXCLAMATION);
  85. ::SetFocus(GetDlgItem(nCtrlID));
  86. }
  87. }
  88. void
  89. CAspMainPage::OnHelp()
  90. {
  91. WinHelp(m_pData->m_HelpPath, HELP_CONTEXT, CAspMainPage::IDD + WINHELP_NUMBER_BASE);
  92. }