⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 password.cpp

📁 我们的网管程序的后台软件,主要是网络方面的内容.
💻 CPP
字号:
// Password.cpp : implementation file
//

#include "stdafx.h"
#include "..\nms.h"
#include "Password.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPassword dialog


CPassword::CPassword(CWnd* pParent /*=NULL*/)
	: CDialog(CPassword::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPassword)
	m_AgainPass = _T("");
	m_NewPass = _T("");
	m_Password = _T("");
	//}}AFX_DATA_INIT
	m_ShowType = 0;
}


void CPassword::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPassword)
	DDX_Text(pDX, IDC_PASSWORD_AGAIN, m_AgainPass);
	DDX_Text(pDX, IDC_PASSWORD_NEW, m_NewPass);
	DDX_Text(pDX, IDC_PASSWORD_PASS, m_Password);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPassword, CDialog)
	//{{AFX_MSG_MAP(CPassword)
	ON_BN_CLICKED(IDC_PASSWORD_CHANGE, OnPasswordChange)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPassword message handlers

void CPassword::OnOK() 
{
	UpdateData();
	if( (m_Password == pApp->m_SysPassword) && (m_ShowType == 0))
	{
		pApp->m_bIsLand = TRUE;
		CDialog::OnOK();
	}
	else if( (m_Password != pApp->m_SysPassword) && (m_ShowType == 0) )
	{
		AfxMessageBox("请输入正确密码!");
	}
	else
	{
		CDialog::OnOK();
	}
}

BOOL CPassword::OnInitDialog() 
{
	CDialog::OnInitDialog();
	

	CRect rcDlg , rcBtn;

	if(!m_ShowType)
	{
		GetDlgItem(IDC_PASSWORD_NEW)->GetWindowRect(&rcBtn);
		GetWindowRect(&rcDlg);

		rcDlg.bottom = rcBtn.top;

		GetDlgItem(IDC_PASSWORD_NEW)->EnableWindow(FALSE);
		GetDlgItem(IDC_PASSWORD_AGAIN)->EnableWindow(FALSE);
		GetDlgItem(IDC_PASSWORD_CHANGE)->EnableWindow(FALSE);
		MoveWindow(rcDlg);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPassword::OnPasswordChange() 
{
	UpdateData();

	if( m_Password != pApp->m_SysPassword ) 
	{
		AfxMessageBox("老密码错误");
		return ;
	}

	if(m_NewPass.GetLength() < 6)
	{
		AfxMessageBox("密码长度太短");
		return ;
	}
	if(m_AgainPass != m_NewPass)
	{
		AfxMessageBox("密码不一致、请重新输入");
	}

	else
	{
		pApp->m_SysPassword = m_NewPass;
		AfxMessageBox("密码修改成功");
		CDialog::OnOK();
	}

}

BOOL CPassword::PreTranslateMessage(MSG* pMsg) 
{
	
	return CDialog::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -