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.

91 lines
1.8 KiB

  1. //
  2. //
  3. //
  4. #include "stdafx.h"
  5. #include "ProcessOpt.h"
  6. LRESULT
  7. CProcessOptPage::OnInitDialog(HWND hDlg, LPARAM lParam)
  8. {
  9. DoDataExchange();
  10. UDACCEL toAcc[3] = {{1, 1}, {3, 5}, {6, 10}};
  11. m_TimeoutSpin.SetRange32(TIMEOUT_MIN, TIMEOUT_MAX);
  12. m_TimeoutSpin.SetPos32(m_pData->m_CgiTimeout);
  13. m_TimeoutSpin.SetAccel(3, toAcc);
  14. DoDataExchange(TRUE);
  15. return FALSE;
  16. }
  17. BOOL
  18. CProcessOptPage::OnKillActive()
  19. {
  20. if (!DoDataExchange(TRUE))
  21. return FALSE;
  22. return SUCCEEDED(m_pData->Save());
  23. }
  24. void
  25. CProcessOptPage::OnDataValidateError(UINT id, BOOL bSave,_XData& data)
  26. {
  27. if (bSave)
  28. {
  29. CString str, fmt, caption;
  30. caption.LoadString(_Module.GetResourceInstance(), IDS_SHEET_TITLE);
  31. switch (data.nDataType)
  32. {
  33. case ddxDataText:
  34. break;
  35. case ddxDataNull:
  36. break;
  37. case ddxDataInt:
  38. fmt.LoadString(_Module.GetResourceInstance(), IDS_ERR_INT_RANGE);
  39. str.Format(fmt, data.intData.nMin, data.intData.nMax);
  40. break;
  41. }
  42. if (!str.IsEmpty())
  43. {
  44. MessageBox(str, caption, MB_OK | MB_ICONEXCLAMATION);
  45. ::SetFocus(GetDlgItem(id));
  46. }
  47. }
  48. }
  49. void
  50. CProcessOptPage::OnDataExchangeError(UINT nCtrlID, BOOL bSave)
  51. {
  52. if (bSave)
  53. {
  54. CString str, fmt, caption;
  55. int min, max;
  56. caption.LoadString(_Module.GetResourceInstance(), IDS_SHEET_TITLE);
  57. switch (nCtrlID)
  58. {
  59. case IDC_CGI_TIMEOUT:
  60. min = TIMEOUT_MIN;
  61. max = TIMEOUT_MAX;
  62. fmt.LoadString(_Module.GetResourceInstance(), IDS_ERR_INT_RANGE);
  63. break;
  64. default:
  65. str.LoadString(_Module.GetResourceInstance(), IDS_ERR_INVALID_DATA);
  66. break;
  67. }
  68. if (!fmt.IsEmpty())
  69. {
  70. str.Format(fmt, min, max);
  71. }
  72. MessageBox(str, caption, MB_OK | MB_ICONEXCLAMATION);
  73. ::SetFocus(GetDlgItem(nCtrlID));
  74. }
  75. }
  76. void
  77. CProcessOptPage::OnHelp()
  78. {
  79. WinHelp(m_pData->m_HelpPath, HELP_CONTEXT, CProcessOptPage::IDD + WINHELP_NUMBER_BASE);
  80. }