📄 dlgaddlogin.cpp
字号:
// DLGaddlogin.cpp : implementation file
//
#include "stdafx.h"
#include "STUGRADE.h"
#include "DLGaddlogin.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDLGaddlogin dialog
CDLGaddlogin::CDLGaddlogin(CWnd* pParent /*=NULL*/)
: CDialog(CDLGaddlogin::IDD, pParent)
{
//{{AFX_DATA_INIT(CDLGaddlogin)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDLGaddlogin::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDLGaddlogin)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDLGaddlogin, CDialog)
//{{AFX_MSG_MAP(CDLGaddlogin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDLGaddlogin message handlers
void CDLGaddlogin::OnOK()
{
// TODO: Add extra validation here
CString user,pass1,pass2;
GetDlgItemText(IDC_EDIT1,user);
GetDlgItemText(IDC_EDIT2,pass1);
GetDlgItemText(IDC_EDIT3,pass2);
if (!m_Flg) //0为修改密码
{
//检查旧密码
if (!m_Checkold) //还没有检查旧密码
{
if (!strcmp(pass1,*m_pPass))
{
SetDlgItemText(IDC_EDITc1,"新密码:");
SetDlgItemText(IDC_EDITc2,"确认新密码:");
CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDITc2);
pEdit->ShowWindow(TRUE);
pEdit = (CEdit*)GetDlgItem(IDC_EDIT3);
pEdit->ShowWindow(TRUE);
SetDlgItemText(IDC_EDIT2,_T(""));
m_Checkold = true; //检查ok
return;
}
else
{
MessageBox("旧密码不正确!","出错",MB_ICONSTOP);
return;
}
}
}
if (user.IsEmpty())
{
MessageBox("用户名不能为空!");
return;
}
if (!strcmp(pass1,pass2))
{
*m_pUser = user;
*m_pPass = pass1;
}
else
{
MessageBox("确认密码不一致!");
return;
}
CDialog::OnOK();
}
BOOL CDLGaddlogin::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_Checkold = false;
if (m_Flg==0) //修改密码
{
SetDlgItemText(IDC_EDIT1,*m_pUser);
SetDlgItemText(IDC_EDITc1,"输入旧密码:");
CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDITc2);
pEdit->ShowWindow(FALSE);
pEdit = (CEdit*)GetDlgItem(IDC_EDIT3);
pEdit->ShowWindow(FALSE);
pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
pEdit->EnableWindow(FALSE);
SetWindowText("更改当前用户密码");
}
else
{
SetDlgItemText(IDC_EDITc1,"密码:");
SetDlgItemText(IDC_EDITc2,"确认密码:");
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -