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

📄 passworddlg.cpp

📁 我上载了那么多怎么都说已经有上载的啦
💻 CPP
字号:
// PasswordDlg.cpp : implementation file
//

#include "stdafx.h"
#include "gpmis.h"
#include "PasswordDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPasswordDlg dialog
extern CGPMISApp theApp;

CPasswordDlg::CPasswordDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPasswordDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPasswordDlg)
	m_strPassword = _T("");
	m_strRe = _T("");
	//}}AFX_DATA_INIT
}


void CPasswordDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPasswordDlg)
	DDX_Text(pDX, IDC_EDIT_PASSWORD, m_strPassword);
	DDX_Text(pDX, IDC_EDIT_RE, m_strRe);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPasswordDlg, CDialog)
	//{{AFX_MSG_MAP(CPasswordDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPasswordDlg message handlers

BOOL CPasswordDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	SetIcon(hIcon, TRUE);	// Set big icon
	SetIcon(hIcon, FALSE);// Set small icon
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPasswordDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	if( m_strPassword != m_strRe )
	{
		AfxMessageBox("输入的两次密码不一致!", MB_OK|MB_ICONSTOP);
		return;
	}
	
	BYTE *pData;
	CBlowfish* pBlowfish = theApp.GetBlowfish();

	pData = new BYTE[17];
	memset(pData, 0, 16*sizeof(BYTE));
	memcpy(pData,m_strPassword,m_strPassword.GetLength());

	pBlowfish->Encrypt(pData, 16);

	CString s;
	m_strPassword = "";
	for(int i = 0; i< 16; i++)
	{
		s.Format("%03d",pData[i]);
		m_strPassword += s;
	}
	delete pData;
	
	theApp.WriteRegistryValue("Parameters\\Administrator","Password",m_strPassword);

	CDialog::OnOK();
}

⌨️ 快捷键说明

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