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

📄 logoindlg.cpp

📁 数据库模拟程序 实现控制台命令词法分析
💻 CPP
字号:
// LogoInDlg.cpp : implementation file
//

#include "stdafx.h"
#include "database.h"
#include "LogoInDlg.h"

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

extern class CUser GlobalUser;
/////////////////////////////////////////////////////////////////////////////
// CLogoInDlg dialog


CLogoInDlg::CLogoInDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CLogoInDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CLogoInDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	isSuccessful = false;
}


void CLogoInDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CLogoInDlg)
	DDX_Control(pDX, IDC_EDT_PWD, m_pwd);
	DDX_Control(pDX, IDC_EDT_USER, m_name);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CLogoInDlg, CDialog)
	//{{AFX_MSG_MAP(CLogoInDlg)
	ON_BN_CLICKED(ID_REGEDIT, OnRegedit)
	ON_EN_SETFOCUS(IDC_EDT_USER, OnSetfocusEdtUser)
	ON_EN_KILLFOCUS(IDC_EDT_USER, OnKillfocusEdtUser)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLogoInDlg message handlers

BOOL CLogoInDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CString str;
	str = "<请输入用户名>";
	m_name.SetWindowText(str);
	m_name.SetSel(-1,-1,false);

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

void CLogoInDlg::OnRegedit() 
{
	// TODO: Add your control notification handler code here
	CRegistDlg dlg;
	dlg.DoModal();
}

void CLogoInDlg::OnSetfocusEdtUser() 
{
	// TODO: Add your control notification handler code here
	SetDlgItemText(IDC_EDT_USER, NULL);
}

void CLogoInDlg::OnOK() 
{
	// TODO: Add extra validation here
	
	UpdateData(true);

	CString strName,strPwd;
	m_name.GetWindowText(strName);
	m_pwd.GetWindowText(strPwd);

	if(user.CheckUser(strName, strPwd))
	{
		isSuccessful = true;
		GlobalUser.SetUser(strName, strPwd);
		CString str;
		str.Format("%s 欢迎你", strName);
		AfxMessageBox(str);
	}
	else
	{
		isSuccessful = false;
	}
	
//	CDialog::OnOK();
}

void CLogoInDlg::OnKillfocusEdtUser() 
{
	// TODO: Add your control notification handler code here
	m_name.SetSel(0, -1);
}

⌨️ 快捷键说明

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