// Psw.cpp : implementation file // #include "stdafx.h" #include "LYFZIPManage.h" #include "Psw.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // Psw dialog Psw::Psw(CWnd* pParent /*=NULL*/) : CDialog(Psw::IDD, pParent) { //{{AFX_DATA_INIT(Psw) m_oldpsw = _T("fdaseer"); m_psw = _T(""); m_psw2 = _T(""); m_psw3 = _T(""); //}}AFX_DATA_INIT } void Psw::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(Psw) DDX_Text(pDX, IDC_EDITpsw, m_psw); DDX_Text(pDX, IDC_EDITpsw2, m_psw2); DDX_Text(pDX, IDC_EDITpsw3, m_psw3); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(Psw, CDialog) //{{AFX_MSG_MAP(Psw) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Psw message handlers void Psw::OnOK() { // TODO: Add extra validation here UpdateData(); if(m_psw!=m_oldpsw) { AfxMessageBox("旧密码错误!", MB_ICONINFORMATION); return; } if(m_psw3!=m_psw2) { AfxMessageBox("新密码不一至!", MB_ICONINFORMATION); return; } CString sql; sql="update psw set psw='"+m_psw3+"'"; MyExecuteSQL(&g_db, sql); AfxMessageBox("修改成功!", MB_ICONINFORMATION); CDialog::OnOK(); } BOOL Psw::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CRecordset myset(&g_db); CString sql="select psw from psw"; myset.Open (CRecordset::forwardOnly, sql); myset.GetFieldValue ("psw", m_oldpsw); myset.Close(); this->CenterWindow (g_pMainWnd); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }