📄 logindlg.cpp
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -