DlgEditPwd.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // DlgEditPwd.cpp : 实现文件
  2. //
  3. #include "stdafx.h"
  4. #include "IDE.h"
  5. #include "DlgEditPwd.h"
  6. #include ".\dlgeditpwd.h"
  7. #include "md5class.h"
  8. // CDlgEditPwd 对话框
  9. IMPLEMENT_DYNAMIC(CDlgEditPwd, CDialog)
  10. CDlgEditPwd::CDlgEditPwd(CWnd* pParent /*=NULL*/)
  11. : CDialog(CDlgEditPwd::IDD, pParent)
  12. {
  13. }
  14. CDlgEditPwd::~CDlgEditPwd()
  15. {
  16. }
  17. void CDlgEditPwd::DoDataExchange(CDataExchange* pDX)
  18. {
  19. CDialog::DoDataExchange(pDX);
  20. DDX_Control(pDX, IDC_EDIT_OLD_PWD, m_ctrlOldPwd);
  21. DDX_Control(pDX, IDC_EDIT_NEW_PWD, m_ctrlNewPwd);
  22. DDX_Control(pDX, IDC_EDIT_CONFIRM_PWD, m_ctrlConfirmPwd);
  23. }
  24. BEGIN_MESSAGE_MAP(CDlgEditPwd, CDialog)
  25. ON_BN_CLICKED(IDOK, OnBnClickedOk)
  26. ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
  27. ON_WM_SHOWWINDOW()
  28. END_MESSAGE_MAP()
  29. // CDlgEditPwd 消息处理程序
  30. void CDlgEditPwd::OnBnClickedOk()
  31. {
  32. // TODO: 在此添加控件通知处理程序代码
  33. UpdateData(TRUE);
  34. CString strNewPwd, strOldPwd, strConfirmPwd, strMsg;
  35. //检查数据有效性
  36. m_ctrlOldPwd.GetWindowText(strOldPwd);
  37. m_ctrlNewPwd.GetWindowText(strNewPwd);
  38. m_ctrlConfirmPwd.GetWindowText(strConfirmPwd);
  39. CMD5 md5OldPwd;
  40. md5OldPwd.setPlainText( (char *)(LPCTSTR)strOldPwd );
  41. CMD5 md5NewPwd;
  42. md5NewPwd.setPlainText( (char *)(LPCTSTR)strNewPwd );
  43. if(strOldPwd.IsEmpty())
  44. {
  45. MessageBox(g_strOldPasswordCannotBlank, g_strTip, MB_ICONINFORMATION);
  46. m_ctrlOldPwd.SetWindowText("");
  47. m_ctrlNewPwd.SetWindowText("");
  48. m_ctrlConfirmPwd.SetWindowText("");
  49. m_ctrlOldPwd.SetFocus();
  50. return;
  51. }
  52. MessageBox(g_strModifyPwdOK, g_strTip, MB_ICONINFORMATION);
  53. OnOK();
  54. }
  55. void CDlgEditPwd::OnBnClickedCancel()
  56. {
  57. // TODO: 在此添加控件通知处理程序代码
  58. OnCancel();
  59. }
  60. BOOL CDlgEditPwd::OnInitDialog()
  61. {
  62. CDialog::OnInitDialog();
  63. // TODO: 在此添加额外的初始化
  64. CString str,s;
  65. GetDlgItem(IDC_STA_SHOW)->GetWindowText( s );
  66. str.Format("%s < %s >",s,g_strLoginUserID );
  67. GetDlgItem(IDC_STA_SHOW)->SetWindowText( str );
  68. return TRUE; // return TRUE unless you set the focus to a control
  69. // 异常: OCX 属性页应返回 FALSE
  70. }
  71. void CDlgEditPwd::OnShowWindow(BOOL bShow, UINT nStatus)
  72. {
  73. CDialog::OnShowWindow(bShow, nStatus);
  74. // TODO: 在此处添加消息处理程序代码
  75. m_ctrlOldPwd.SetFocus();
  76. }