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

📄 password.cpp

📁 visual c++ 实例编程
💻 CPP
字号:
// password.cpp : implementation file
//

#include "stdafx.h"
#include "作品.h"
#include "password.h"
#include "作品Dlg.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_pwd = _T("");
	//}}AFX_DATA_INIT
}


void Cpassword::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Cpassword)
	DDX_Text(pDX, IDC_EDIT1, m_pwd);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Cpassword, CDialog)
	//{{AFX_MSG_MAP(Cpassword)
	ON_WM_CLOSE()
	ON_BN_CLICKED(IDC_BUTTON_ok, OnBUTTONok)
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Cpassword message handlers



void Cpassword::OnClose() 
{
	Cpassword::OnBUTTONok();
}

void Cpassword::OnBUTTONok() 
{
	UpdateData(true);
	if((pwd=="")||(pwd==m_pwd))
		Cpassword::OnOK();
	else
		AfxMessageBox("对不起,密码错误。");

		
}

int Cpassword::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	file.Open("std.dat",CFile::modeRead|CFile::typeText,NULL);
	file.ReadString(pwd);
	file.Close();
	return 0;
}

⌨️ 快捷键说明

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