| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 论坛
 上传资源
上传编程相关的资源,源源不断赚取资源分,以备将来下载之需
海贼王凡
文件大小:8.25 MB
文件类型:rar
发布时间:2015-09-02 10:03:12
需资源分:4
下载次数:2
Tag:基于学生信息管理系统MFC形式的
::资源简介::
// ChgCipherDlg.cpp : implementation file
//

#include "stdafx.h"
#include "graduate.h"
#include "ChgCipherDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChgCipherDlg dialog


CChgCipherDlg::CChgCipherDlg(CWnd* pParent /*=NULL*/)
    : CDialog(CChgCipherDlg::IDD, pParent)
{
    //{{AFX_DATA_INIT(CChgCipherDlg)
    m_affirmCipher = _T("");
    m_newCipher = _T("");
    m_title = _T("");
    m_username = _T("");
    //}}AFX_DATA_INIT
}


void CChgCipherDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CChgCipherDlg)
    DDX_Text(pDX, IDC_EDIT_AFFIRMCIPHER, m_affirmCipher);
    DDX_Text(pDX, IDC_EDIT_NEWCIPHER, m_newCipher);
    DDX_Text(pDX, IDC_EDIT_TITLE2, m_title);
    DDX_Text(pDX, IDC_EDIT_USERNAME2, m_username);
    //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CChgCipherDlg, CDialog)
    //{{AFX_MSG_MAP(CChgCipherDlg)
    ON_BN_CLICKED(IDC_BUTTON_CONFIRM, OnButtonConfirm)
    ON_BN_CLICKED(IDC_BUTTON_CANCEL, OnButtonCancel)
    ON_WM_CTLCOLOR()
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChgCipherDlg message handlers

void CChgCipherDlg::OnOK() 
{
    // TODO: Add extra validation here
}

void CChgCipherDlg::OnButtonConfirm() 
{
    // TODO: Add your control notification handler code here
    CString sql;
    UpdateData();
    if(m_newCipher.IsEmpty()||m_affirmCipher.IsEmpty())
    {
        GetDlgItem(IDC_CUE)->SetWindowText("新密码或确认密码不能为空");
        return;
    }
    if(m_newCipher==m_affirmCipher)
    {
        sql="update login set password='"+m_newCipher+"' where username='"+m_username+"'";
        try
        {
            theApp.m_conn->Execute((_bstr_t)sql,NULL,adCmdText);
            GetDlgItem(IDC_CUE)->SetWindowText("密码修改成功");
        }
        catch(_com_error &e)
        {
            MessageBox(e.Description());
        }
    }
    else
    {
        GetDlgItem(IDC_CUE)->SetWindowText("新密码与确认密码不一致");
        m_newCipher="";
        m_affirmCipher="";
        GetDlgItem(IDC_EDIT_NEWCIPHER)->SetFocus();
        UpdateData(false);
    }
    
}

BOOL CChgCipherDlg::OnInitDialog() 
{
    CDialog::OnInitDialog();
    
    // TODO: Add extra initialization here
    m_title=theApp.m_status;
    m_username=theApp.m_username;
    UpdateData(false);
    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}

void CChgCipherDlg::OnButtonCancel() 
{
    // TODO: Add your control notification handler code here
    CChgCipherDlg::OnCancel();
}



HBRUSH CChgCipherDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
    
    // TODO: Change any attributes of the DC here
    if(pWnd->GetDlgCtrlID()==IDC_CUE)
    {
        pDC->SetTextColor(RGB(255,0,0));
        pDC->SetBkMode(TRANSPARENT);
    }
    // TODO: Return a different brush if the default is not desired
    return hbr;
}
::下载地址::

BCCN本地下载 
开通VIP
可免资源分下载所有资源
::下载本资源的人也下载了::
::作者其它资源::
 
>> 评论
 
热门Tag:
 
编程中国 版权所有,并保留所有权利。 在线客服
微信扫码咨询

Powered by BCCN 1.020, Processed in 0.005933 second(s)
Copyright©2010-2024, BCCN.NET, All Rights Reserved

在线客服
微信扫码咨询