?? changkey.cpp
字號(hào):
// CHANGKEY.cpp : implementation file
//
#include "stdafx.h"
#include "dangan.h"
#include "CHANGKEY.h"
#include "AllDlg.h"
#include "fstream.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCHANGKEY dialog
CCHANGKEY::CCHANGKEY(CWnd* pParent /*=NULL*/)
: CDialog(CCHANGKEY::IDD, pParent)
{
//{{AFX_DATA_INIT(CCHANGKEY)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CCHANGKEY::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCHANGKEY)
DDX_Control(pDX, IDC_EDIT_2NEWKEY, m_2newkey);
DDX_Control(pDX, IDC_EDIT_OKEY, m_oldkey);
DDX_Control(pDX, IDC_EDIT_NKEY, m_newkey);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCHANGKEY, CDialog)
//{{AFX_MSG_MAP(CCHANGKEY)
ON_EN_CHANGE(IDC_EDIT_OKEY, OnChangeEditOkey)
ON_EN_CHANGE(IDC_EDIT_NKEY, OnChangeEditNkey)
ON_EN_CHANGE(IDC_EDIT_2NEWKEY, OnChangeEdit2newkey)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCHANGKEY message handlers
CString oldkey;
CString newkey;
CString tnewkey;
void CCHANGKEY::OnChangeEditOkey()
{
m_oldkey.GetWindowText(oldkey);
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CCHANGKEY::OnChangeEditNkey()
{
m_newkey.GetWindowText(newkey);
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
CString nchangkey[50];
char nkey[50];
void NInputKey(){
int i=0;
ifstream in("key.txt");
in>>nkey;
// MessageBox(inkey[50]);
nchangkey[i]=nkey;
in.close();
}
//void Output(){
void CCHANGKEY::OnOK()
{
NInputKey();
int i=0;
if(oldkey==nchangkey[i]){
// CDialog::OnOK();
// CAllDlg dlg;
// dlg.DoModal();
if(newkey==tnewkey){
ofstream out("key.txt");
out<<newkey;
out.close();
MessageBox("密碼修改成功!");
CDialog::OnOK();
CAllDlg dlg;
dlg.DoModal();
}
else{
AfxMessageBox("兩次輸入的密碼不同\n密碼修改失敗!\n請(qǐng)重新輸入!");
UpdateData(FALSE);
}
}
else{
AfxMessageBox("您輸入的原密碼有誤,\n請(qǐng)重新輸入!");
// UpdateWindow(FALSE);
}
// CDialog::OnOK();
}
void CCHANGKEY::OnChangeEdit2newkey()
{
m_2newkey.GetWindowText(tnewkey);
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -