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.

102 lines
2.0 KiB

  1. // ProxyDialog.cpp : implementation file
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation
  4. //
  5. // 03/24/00 v-marfin : 63447 : Fox for proxy property.
  6. //
  7. #include "stdafx.h"
  8. #include "snapin.h"
  9. #include "ProxyDialog.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CProxyDialog dialog
  17. CProxyDialog::CProxyDialog(CWnd* pParent /*=NULL*/)
  18. : CDialog(CProxyDialog::IDD, pParent)
  19. {
  20. //{{AFX_DATA_INIT(CProxyDialog)
  21. m_bUseProxy = FALSE;
  22. m_sPort = _T("");
  23. m_sAddress = _T("");
  24. //}}AFX_DATA_INIT
  25. }
  26. void CProxyDialog::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CDialog::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(CProxyDialog)
  30. DDX_Check(pDX, IDC_CHECK_USE, m_bUseProxy);
  31. DDX_Text(pDX, IDC_EDIT_PORT, m_sPort);
  32. DDX_Text(pDX, IDC_EDIT_SERVER, m_sAddress);
  33. //}}AFX_DATA_MAP
  34. GetDlgItem(IDC_EDIT_SERVER)->EnableWindow(m_bUseProxy==TRUE);
  35. GetDlgItem(IDC_EDIT_PORT)->EnableWindow(m_bUseProxy==TRUE);
  36. }
  37. BEGIN_MESSAGE_MAP(CProxyDialog, CDialog)
  38. //{{AFX_MSG_MAP(CProxyDialog)
  39. ON_BN_CLICKED(IDC_CHECK_USE, OnCheckUse)
  40. //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CProxyDialog message handlers
  44. void CProxyDialog::OnCheckUse()
  45. {
  46. UpdateData();
  47. }
  48. BOOL CProxyDialog::OnInitDialog()
  49. {
  50. CDialog::OnInitDialog();
  51. return TRUE; // return TRUE unless you set the focus to a control
  52. // EXCEPTION: OCX Property Pages should return FALSE
  53. }
  54. void CProxyDialog::OnOK()
  55. {
  56. UpdateData();
  57. if (m_bUseProxy)
  58. {
  59. m_sPort.TrimRight();
  60. m_sPort.TrimLeft();
  61. m_sAddress.TrimRight();
  62. m_sAddress.TrimLeft();
  63. if (m_sPort.IsEmpty())
  64. {
  65. AfxMessageBox(IDS_ERR_PROXY_REQ);
  66. UpdateData(FALSE);
  67. GetDlgItem(IDC_EDIT_PORT)->SetFocus();
  68. return;
  69. }
  70. if (m_sAddress.IsEmpty())
  71. {
  72. AfxMessageBox(IDS_ERR_PROXY_REQ);
  73. UpdateData(FALSE);
  74. GetDlgItem(IDC_EDIT_SERVER)->SetFocus();
  75. return;
  76. }
  77. }
  78. else
  79. {
  80. m_sPort.Empty();
  81. m_sAddress.Empty();
  82. }
  83. CDialog::OnOK();
  84. }