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.

133 lines
2.7 KiB

  1. /*++
  2. Copyright (C) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. fileprop.cpp
  5. Abstract:
  6. Implementation of the files property page.
  7. --*/
  8. #include "stdafx.h"
  9. #include "dialogs.h"
  10. #include "smcfghlp.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. USE_HANDLE_MACROS("SMLOGCFG(dialogs.cpp)");
  17. static ULONG
  18. sPASSWORD_aulHelpIds[] =
  19. {
  20. IDC_USERNAME, IDH_USERNAME,
  21. IDC_PASSWORD1, IDH_CTRS_ENTER_PWD,
  22. IDC_PASSWORD2, IDH_CTRS_REENTER_PWD,
  23. 0,0
  24. };
  25. void KillString( CString& str )
  26. {
  27. LONG nSize = str.GetLength();
  28. for( LONG i=0;i<nSize;i++ ){
  29. str.SetAt( i, '*');
  30. }
  31. }
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CPasswordDlg dialog
  34. CPasswordDlg::CPasswordDlg(CWnd* pParent /*=NULL*/)
  35. : CDialog(CPasswordDlg::IDD, pParent)
  36. {
  37. //{{AFX_DATA_INIT(CPasswordDlg)
  38. m_strUserName = _T("");
  39. m_strPassword1 = _T("");
  40. m_strPassword2 = _T("");
  41. //}}AFX_DATA_INIT
  42. }
  43. CPasswordDlg::~CPasswordDlg()
  44. {
  45. KillString( m_strPassword1 );
  46. KillString( m_strPassword2 );
  47. }
  48. void CPasswordDlg::DoDataExchange(CDataExchange* pDX)
  49. {
  50. CDialog::DoDataExchange(pDX);
  51. //{{AFX_DATA_MAP(CPasswordDlg)
  52. DDX_Text(pDX, IDC_USERNAME, m_strUserName);
  53. DDX_Text(pDX, IDC_PASSWORD1, m_strPassword1);
  54. DDX_Text(pDX, IDC_PASSWORD2, m_strPassword2);
  55. //}}AFX_DATA_MAP
  56. }
  57. BOOL CPasswordDlg::OnInitDialog()
  58. {
  59. if( m_strUserName.GetLength() ){
  60. GetDlgItem( IDC_USERNAME )->EnableWindow(FALSE);
  61. GetDlgItem( IDC_PASSWORD1 )->SetFocus();
  62. }
  63. CDialog::OnInitDialog();
  64. return FALSE;
  65. }
  66. void CPasswordDlg::OnOK()
  67. {
  68. UpdateData();
  69. if( m_strPassword1 != m_strPassword2 ){
  70. CString strMessage;
  71. CString strTitle;
  72. strMessage.LoadString ( IDS_BAD_PASSWORD_MATCH );
  73. strTitle.LoadString( IDS_PASSWORD_TITLE );
  74. MessageBox ( strMessage, strTitle, MB_OK | MB_ICONERROR);
  75. GetDlgItem( IDC_PASSWORD1 )->SetFocus();
  76. return;
  77. }
  78. CDialog::OnOK();
  79. }
  80. BOOL
  81. CPasswordDlg::OnHelpInfo(HELPINFO * pHelpInfo)
  82. {
  83. if (pHelpInfo->iCtrlId >= IDC_PWD_FIRST_HELP_CTRL_ID ||
  84. pHelpInfo->iCtrlId == IDOK ||
  85. pHelpInfo->iCtrlId== IDCANCEL ) {
  86. InvokeWinHelp(WM_HELP,
  87. NULL,
  88. (LPARAM) pHelpInfo,
  89. m_strHelpFilePath,
  90. sPASSWORD_aulHelpIds);
  91. }
  92. return TRUE;
  93. }
  94. DWORD
  95. CPasswordDlg::SetContextHelpFilePath(const CString& rstrPath)
  96. {
  97. DWORD dwStatus = ERROR_SUCCESS;
  98. MFC_TRY
  99. m_strHelpFilePath = rstrPath;
  100. MFC_CATCH_DWSTATUS
  101. return dwStatus;
  102. }
  103. BEGIN_MESSAGE_MAP(CPasswordDlg, CDialog)
  104. //{{AFX_MSG_MAP(CPasswordDlg)
  105. ON_WM_HELPINFO()
  106. //}}AFX_MSG_MAP
  107. END_MESSAGE_MAP()