logindlg.cpp
来自「一个简单的VC数据库程序! 一个简单的VC数据库程序!」· C++ 代码 · 共 81 行
CPP
81 行
// LoginDlg.cpp : implementation file
//
#include "stdafx.h"
#include "UserReg.h"
#include "LoginDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLoginDlg dialog
CLoginDlg::CLoginDlg(CWnd* pParent /*=NULL*/)
: CDialog(CLoginDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CLoginDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CLoginDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLoginDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLoginDlg, CDialog)
//{{AFX_MSG_MAP(CLoginDlg)
ON_BN_CLICKED(IDC_BUTTON_NO, OnButtonNo)
ON_BN_CLICKED(IDC_BUTTON_YES, OnButtonYes)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLoginDlg message handlers
void CLoginDlg::OnButtonNo()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
void CLoginDlg::OnButtonYes()
{
// TODO: Add your control notification handler code here
CString Name="";
CString Psw="";
GetDlgItem(IDC_EDIT_NAME)->GetWindowText(Name);
GetDlgItem(IDC_EDIT_PSW)->GetWindowText(Psw);
if(strlen(Name)<=0)
{
MessageBox("用户名不能为空!");
return;
}
if(strlen(Psw)<=0)
{
MessageBox("密码不能为空!");
return;
}
if(strcmp("admin",Name)!=0)
{
MessageBox("用户名不存在!");
return;
}
if(strcmp("123",Psw)!=0)
{
MessageBox("密码错误!");
return;
}
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?