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.

172 lines
4.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1998
  6. //
  7. // File: newprof.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // NewProf.cpp : implementation file
  11. //
  12. #include "stdafx.h"
  13. #include "acsadmin.h"
  14. #include "dsacsuse.h"
  15. #include "NewProf.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CDlgNewProf dialog
  23. #if 0 // concept of profile is removed
  24. CDlgNewProf::CDlgNewProf(CWnd* pParent /*=NULL*/)
  25. : CACSDialog(CDlgNewProf::IDD, pParent)
  26. {
  27. m_pNameList = NULL;
  28. //{{AFX_DATA_INIT(CDlgNewProf)
  29. m_strProfileName = _T("");
  30. //}}AFX_DATA_INIT
  31. m_pBox = NULL;
  32. }
  33. CDlgNewProf::~CDlgNewProf()
  34. {
  35. delete m_pBox;
  36. }
  37. void CDlgNewProf::DoDataExchange(CDataExchange* pDX)
  38. {
  39. CACSDialog::DoDataExchange(pDX);
  40. //{{AFX_DATA_MAP(CDlgNewProf)
  41. DDX_CBString(pDX, IDC_COMBOPROFILENAME, m_strProfileName);
  42. DDV_MaxChars(pDX, m_strProfileName, 128);
  43. //}}AFX_DATA_MAP
  44. }
  45. BEGIN_MESSAGE_MAP(CDlgNewProf, CACSDialog)
  46. //{{AFX_MSG_MAP(CDlgNewProf)
  47. ON_CBN_EDITCHANGE(IDC_COMBOPROFILENAME, OnEditchangeComboprofilename)
  48. //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CDlgNewProf message handlers
  52. void CDlgNewProf::OnEditchangeComboprofilename()
  53. {
  54. CEdit *pEdit = (CEdit*)GetDlgItem(IDC_COMBOPROFILENAME);
  55. CString str;
  56. pEdit->GetWindowText(str);
  57. ASSERT(m_pNameList);
  58. BOOL bEnable = (str.GetLength() && (m_pNameList->Find(str) == -1));
  59. GetDlgItem(IDOK)->EnableWindow(bEnable);
  60. }
  61. #endif // #if 0
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CDlgNewExtUser dialog
  64. CDlgNewExtUser::CDlgNewExtUser(CWnd* pParent /*=NULL*/)
  65. : CACSDialog(CDlgNewExtUser::IDD, pParent)
  66. {
  67. //{{AFX_DATA_INIT(CDlgNewExtUser)
  68. m_strExtUserName = _T("");
  69. //}}AFX_DATA_INIT
  70. }
  71. void CDlgNewExtUser::DoDataExchange(CDataExchange* pDX)
  72. {
  73. CACSDialog::DoDataExchange(pDX);
  74. //{{AFX_DATA_MAP(CDlgNewExtUser)
  75. DDX_Text(pDX, IDC_EDITEXTERALUSERNAME, m_strExtUserName);
  76. DDV_MaxChars(pDX, m_strExtUserName, 128);
  77. //}}AFX_DATA_MAP
  78. }
  79. BEGIN_MESSAGE_MAP(CDlgNewExtUser, CACSDialog)
  80. //{{AFX_MSG_MAP(CDlgNewExtUser)
  81. ON_EN_CHANGE(IDC_EDITEXTERALUSERNAME, OnChangeEditexteralusername)
  82. //}}AFX_MSG_MAP
  83. END_MESSAGE_MAP()
  84. /////////////////////////////////////////////////////////////////////////////
  85. // CDlgNewExtUser message handlers
  86. void CDlgNewExtUser::OnChangeEditexteralusername()
  87. {
  88. CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDITEXTERALUSERNAME);
  89. CString str;
  90. pEdit->GetWindowText(str);
  91. ASSERT(m_pNameList);
  92. BOOL bEnable = (str.GetLength() && (m_pNameList->Find(str) == -1));
  93. GetDlgItem(IDOK)->EnableWindow(bEnable);
  94. }
  95. #if 0 // profile folder is removed, the concept of profile is remvoed
  96. BOOL CDlgNewProf::OnInitDialog()
  97. {
  98. CACSDialog::OnInitDialog();
  99. HRESULT hr = S_OK;
  100. CStrArray* pStrArray;
  101. CString* pStr = NULL;
  102. CComObject<CACSGlobalProfiles>* pObj;
  103. CHECK_HR( hr = CComObject<CACSGlobalProfiles>::CreateInstance(&pObj));
  104. ASSERT(pObj);
  105. m_spGlobalProfiles = (CACSGlobalProfiles*)pObj;
  106. CHECK_HR( hr = m_spGlobalProfiles->Open());
  107. pStrArray = m_spGlobalProfiles->GetChildrenNameList();
  108. try{
  109. if(pStrArray)
  110. m_GlobalProfileNames = *pStrArray;
  111. // remove the profile names already exist in this subnet
  112. for(int i = m_GlobalProfileNames.GetSize() - 1; i >= 0; i--)
  113. {
  114. pStr = m_GlobalProfileNames[i];
  115. if(m_pNameList->Find(*pStr) != -1)
  116. {
  117. m_GlobalProfileNames.RemoveAt(i);
  118. delete pStr;
  119. }
  120. }
  121. // Initialize combo box list
  122. // fillin the list box
  123. m_pBox = new CStrBox<CComboBox>(this, IDC_COMBOPROFILENAME, m_GlobalProfileNames);
  124. m_pBox->Fill();
  125. }
  126. catch(CMemoryException&)
  127. {
  128. CHECK_HR(hr = E_OUTOFMEMORY);
  129. };
  130. L_ERR:
  131. if FAILED(hr)
  132. ReportError(hr, IDS_ERR_COMMAND, NULL);
  133. return TRUE; // return TRUE unless you set the focus to a control
  134. // EXCEPTION: OCX Property Pages should return FALSE
  135. }
  136. #endif // #if 0