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.

83 lines
1.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1998
  6. //
  7. // File: newsub.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // newsub.cpp : implementation file
  11. //
  12. #include "stdafx.h"
  13. #include "resource.h"
  14. #include "acsadmin.h"
  15. #include "acs.h"
  16. #include "newsub.h"
  17. extern "C"
  18. {
  19. #include <dsgetdc.h> // DsValidateSubnetName
  20. }
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CDlgNewSubnet dialog
  28. CDlgNewSubnet::CDlgNewSubnet(CWnd* pParent /*=NULL*/)
  29. : CACSDialog(CDlgNewSubnet::IDD, pParent)
  30. {
  31. m_pNameList = NULL;
  32. //{{AFX_DATA_INIT(CDlgNewSubnet)
  33. m_strSubnetName = _T("");
  34. //}}AFX_DATA_INIT
  35. }
  36. void CDlgNewSubnet::DoDataExchange(CDataExchange* pDX)
  37. {
  38. CACSDialog::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(CDlgNewSubnet)
  40. DDX_Text(pDX, IDC_EDITSUBNETNAME, m_strSubnetName);
  41. DDV_MaxChars(pDX, m_strSubnetName, 128);
  42. //}}AFX_DATA_MAP
  43. }
  44. BEGIN_MESSAGE_MAP(CDlgNewSubnet, CACSDialog)
  45. //{{AFX_MSG_MAP(CDlgNewSubnet)
  46. ON_EN_CHANGE(IDC_EDITSUBNETNAME, OnChangeEditsubnetname)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CDlgNewSubnet message handlers
  51. void CDlgNewSubnet::OnChangeEditsubnetname()
  52. {
  53. CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDITSUBNETNAME);
  54. CString str;
  55. pEdit->GetWindowText(str);
  56. ASSERT(m_pNameList);
  57. BOOL bEnable = (str.GetLength() && (m_pNameList->Find(str) == -1));
  58. GetDlgItem(IDOK)->EnableWindow(bEnable);
  59. }
  60. void CDlgNewSubnet::OnOK()
  61. {
  62. UpdateData(TRUE );
  63. DWORD dw = ::DsValidateSubnetName( (LPCTSTR)m_strSubnetName );
  64. if (ERROR_SUCCESS != dw)
  65. AfxMessageBox(IDS_ERR_SUBNET_NAME);
  66. else
  67. CACSDialog::OnOK();
  68. }