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.

159 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. NWWKS.cpp : implementation file
  5. CPropertyPage support for User mgmt wizard
  6. File History:
  7. JonY Apr-96 created
  8. --*/
  9. #include "stdafx.h"
  10. #include "speckle.h"
  11. #include "NWWKS.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CAddNWWKS dialog
  19. CAddNWWKS::CAddNWWKS(CWnd* pParent /*=NULL*/)
  20. : CDialog(CAddNWWKS::IDD, pParent)
  21. {
  22. //{{AFX_DATA_INIT(CAddNWWKS)
  23. m_csNetworkAddress = _T("");
  24. m_csNodeAddress = _T("");
  25. //}}AFX_DATA_INIT
  26. }
  27. void CAddNWWKS::DoDataExchange(CDataExchange* pDX)
  28. {
  29. CDialog::DoDataExchange(pDX);
  30. //{{AFX_DATA_MAP(CAddNWWKS)
  31. DDX_Text(pDX, IDC_NETWORK_ADDRESS_EDIT, m_csNetworkAddress);
  32. DDX_Text(pDX, IDC_NODE_ADDRESS_EDIT, m_csNodeAddress);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(CAddNWWKS, CDialog)
  36. //{{AFX_MSG_MAP(CAddNWWKS)
  37. ON_EN_CHANGE(IDC_NETWORK_ADDRESS_EDIT, OnChangeNetworkAddressEdit)
  38. ON_EN_CHANGE(IDC_NODE_ADDRESS_EDIT, OnChangeNodeAddressEdit)
  39. //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CAddNWWKS message handlers
  43. void CAddNWWKS::OnOK()
  44. {
  45. // 8 digit address
  46. // 12 digit node
  47. // network is req'd. Node is not.
  48. UpdateData(TRUE);
  49. if (m_csNetworkAddress == L"")
  50. {
  51. AfxMessageBox(IDS_NEED_ADDRESS);
  52. GetDlgItem(IDC_NETWORK_ADDRESS_EDIT)->SetFocus();
  53. return;
  54. }
  55. if (m_csNetworkAddress.FindOneOf(L"GgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~`!@#$%^&*()-_+={[}}]|\\:;\"',<.>/?") != -1)
  56. {
  57. AfxMessageBox(IDS_BAD_NWADDRESS);
  58. GetDlgItem(IDC_NETWORK_ADDRESS_EDIT)->SetFocus();
  59. return;
  60. }
  61. if (m_csNetworkAddress.GetLength() > 8)
  62. {
  63. AfxMessageBox(IDS_TOOLONG_NWADDRESS);
  64. GetDlgItem(IDC_NETWORK_ADDRESS_EDIT)->SetFocus();
  65. return;
  66. }
  67. if (m_csNodeAddress.FindOneOf(L"GgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~`!@#$%^&*()-_+={[}}]|\\:;\"',<.>/?") != -1)
  68. {
  69. AfxMessageBox(IDS_BAD_NWNODE);
  70. GetDlgItem(IDC_NODE_ADDRESS_EDIT)->SetFocus();
  71. return;
  72. }
  73. if (m_csNodeAddress.GetLength() > 12)
  74. {
  75. AfxMessageBox(IDS_TOOLONG_NWNODE);
  76. GetDlgItem(IDC_NODE_ADDRESS_EDIT)->SetFocus();
  77. return;
  78. }
  79. if (m_csNodeAddress == L"")
  80. {
  81. if (AfxMessageBox(IDS_ALL_NODES, MB_YESNO | MB_ICONEXCLAMATION) == IDYES)
  82. m_csNodeAddress = L"-1";
  83. else return;
  84. }
  85. // pad out the numbers to the appropriate length
  86. while (m_csNodeAddress.GetLength() < 12) m_csNodeAddress = L"0" + m_csNodeAddress;
  87. while (m_csNetworkAddress.GetLength() < 8) m_csNetworkAddress = L"0" + m_csNetworkAddress;
  88. EndDialog(1);
  89. }
  90. void CAddNWWKS::OnCancel()
  91. {
  92. EndDialog(0);
  93. }
  94. BOOL CAddNWWKS::OnInitDialog()
  95. {
  96. CDialog::OnInitDialog();
  97. GetDlgItem(IDC_NETWORK_ADDRESS_EDIT)->SetFocus();
  98. return FALSE; // return TRUE unless you set the focus to a control
  99. // EXCEPTION: OCX Property Pages should return FALSE
  100. }
  101. void CAddNWWKS::OnChangeNetworkAddressEdit()
  102. {
  103. UpdateData(TRUE);
  104. if (m_csNetworkAddress.FindOneOf(L"GgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~`!@#$%^&*()-_+={[}}]|\\:;\"',<.>/?") != -1)
  105. {
  106. AfxMessageBox(IDS_BAD_NWADDRESS);
  107. }
  108. if (m_csNetworkAddress.GetLength() > 8)
  109. {
  110. AfxMessageBox(IDS_TOOLONG_NWADDRESS);
  111. }
  112. }
  113. void CAddNWWKS::OnChangeNodeAddressEdit()
  114. {
  115. UpdateData(TRUE);
  116. if (m_csNodeAddress.FindOneOf(L"GgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~`!@#$%^&*()-_+={[}}]|\\:;\"',<.>/?") != -1)
  117. AfxMessageBox(IDS_BAD_NWNODE);
  118. if (m_csNodeAddress.GetLength() > 12)
  119. AfxMessageBox(IDS_TOOLONG_NWNODE);
  120. }