Leaked source code of windows server 2003
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.

103 lines
2.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation 1996-2001.
  5. //
  6. // File: profdesc.cpp
  7. //
  8. // Contents: implementation of CSetProfileDescription
  9. //
  10. //----------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include "wsecmgr.h"
  13. #include "cookie.h"
  14. #include "snapmgr.h"
  15. #include "profdesc.h"
  16. #include "util.h"
  17. #ifdef _DEBUG
  18. #define new DEBUG_NEW
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CSetProfileDescription dialog
  24. CSetProfileDescription::CSetProfileDescription()
  25. : CHelpDialog(a218HelpIDs, IDD, 0)
  26. {
  27. //{{AFX_DATA_INIT(CSetProfileDescription)
  28. m_strDesc = _T("");
  29. //}}AFX_DATA_INIT
  30. }
  31. void CSetProfileDescription::DoDataExchange(CDataExchange* pDX)
  32. {
  33. CDialog::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(CSetProfileDescription)
  35. DDX_Text(pDX, IDC_DESCRIPTION, m_strDesc);
  36. //}}AFX_DATA_MAP
  37. }
  38. BEGIN_MESSAGE_MAP(CSetProfileDescription, CHelpDialog)
  39. //{{AFX_MSG_MAP(CSetProfileDescription)
  40. //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CSetProfileDescription message handlers
  44. void CSetProfileDescription::OnOK()
  45. {
  46. UpdateData(TRUE);
  47. //
  48. // empty the description section first.
  49. //
  50. CEditTemplate *pet;
  51. LPCTSTR szInfFile;
  52. if( !m_strDesc.IsEmpty() ) //Raid #482845, Yanggao
  53. {
  54. m_strDesc.Replace(L"\r\n", NULL);
  55. }
  56. PCWSTR szInvalidCharSet = INVALID_DESC_CHARS; //Raid 481533, yanggao, 11/27/2001
  57. if( m_strDesc.FindOneOf(szInvalidCharSet) != -1 )
  58. {
  59. CString text;
  60. text.FormatMessage (IDS_INVALID_DESC, szInvalidCharSet);
  61. AfxMessageBox(text);
  62. GetDlgItem(IDC_DESCRIPTION)->SetFocus();
  63. return;
  64. }
  65. szInfFile = m_pFolder->GetInfFile();
  66. if (szInfFile) {
  67. pet = m_pCDI->GetTemplate(szInfFile);
  68. pet->SetDescription(m_strDesc);
  69. pet->Save(); //Raid #453581, Yang Gao, 8/10/2001
  70. }
  71. m_pFolder->SetDesc(m_strDesc);
  72. DestroyWindow();
  73. }
  74. void CSetProfileDescription::OnCancel()
  75. {
  76. DestroyWindow();
  77. }
  78. BOOL CSetProfileDescription::OnInitDialog()
  79. {
  80. CDialog::OnInitDialog();
  81. GetDlgItem(IDC_DESCRIPTION)->SendMessage(EM_LIMITTEXT, MAX_PATH, 0); //Raid #525155, Yanggao, 4/1/2002
  82. return TRUE; // return TRUE unless you set the focus to a control
  83. // EXCEPTION: OCX Property Pages should return FALSE
  84. }