📄 dlogin.cpp
字号:
// DLogin.cpp : implementation file
//
#include "stdafx.h"
#include "htglxt.h"
#include "DLogin.h"
#include "DMain.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "RxRecordset.h"
/////////////////////////////////////////////////////////////////////////////
// CDLogin dialog
CDLogin::CDLogin(CWnd* pParent /*=NULL*/)
: CDialog(CDLogin::IDD, pParent)
{
//{{AFX_DATA_INIT(CDLogin)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
nNum=0;
}
void CDLogin::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDLogin)
DDX_Control(pDX, IDC_EDTUSERNAME, m_EdtUserName);
DDX_Control(pDX, IDC_EDTPWD, m_EdtPwd);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDLogin, CDialog)
//{{AFX_MSG_MAP(CDLogin)
ON_BN_CLICKED(IDC_BUTSURE, OnButsure)
ON_BN_CLICKED(IDC_BUTEXIT1, OnButexit1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDLogin message handlers
void CDLogin::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
}
void CDLogin::OnButsure()
{
RxRecordset rst;
CString sUserName,sPwd,sPwd2,sSQL;
this->m_EdtUserName.GetWindowText(sUserName);
this->m_EdtPwd.GetWindowText(sPwd);
sSQL.Format("SELECT * FROM 用户信息表 WHERE 用户名='%s'",sUserName);
rst.Open(sSQL,adCmdText);
if(rst.GetRecordCount()<1)
{
MessageBox("您输入的用户不存在!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
m_EdtUserName.SetWindowText("");
m_EdtUserName.SetFocus();
nNum++;
goto end;
}
else
{
sPwd2=rst.GetFieldValue("密码");
if(sPwd==sPwd2)
{
OP=sUserName;
this->OnCancel();
CDMain dlg;
dlg.DoModal();
}
else
{
MessageBox("您输入的密码不正确!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
m_EdtPwd.SetWindowText("");
m_EdtPwd.SetFocus();
nNum++;
goto end;
}
}
end: if(nNum>=3)
{
MessageBox("您已经达到了密码输入的最大次数,请与管理员联系!","系统提示",MB_OK|MB_ICONSTOP);
this->OnCancel();
}
}
void CDLogin::OnButexit1()
{
this->OnCancel();
}
BOOL CDLogin::OnInitDialog()
{
CDialog::OnInitDialog();
RxRecordset rst;
rst.Open("用户信息表");
if(rst.GetRecordCount()<1)
{
OP="超级管理员";
this->OnCancel();
CDMain dlg;
dlg.DoModal();
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -