📄 dldlg.cpp
字号:
// dlDlg.cpp : implementation file
//
#include "stdafx.h"
#include "glxt.h"
#include "dlDlg.h"
#include "regeDlg.h"
#include "regeDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CdlDlg dialog
CdlDlg::CdlDlg(CWnd* pParent /*=NULL*/)
: CDialog(CdlDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CdlDlg)
m_password = _T("");
m_usename = _T("");
m_ms = _T("");
//}}AFX_DATA_INIT
kind="管理员";
}
void CdlDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CdlDlg)
DDX_Control(pDX, IDC_EDIT2, m_ctrpword);
DDX_Control(pDX, IDC_EDIT1, m_ctruse);
DDX_Control(pDX, IDC_RADIO1, m_selet);
DDX_Text(pDX, IDC_EDIT2, m_password);
DDX_Text(pDX, IDC_EDIT1, m_usename);
DDX_Text(pDX, IDC_EDIT3, m_ms);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CdlDlg, CDialog)
//{{AFX_MSG_MAP(CdlDlg)
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_RADIO1, Ongunli)
ON_BN_CLICKED(IDC_RADIO2, Onyewu)
ON_BN_CLICKED(IDOK, Onlogin)
ON_BN_CLICKED(IDC_BUTTON1, Onzhuce)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CdlDlg message handlers
BOOL CdlDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_selet.SetCheck(1);
m_db.Open(_T("gshDSN"));
m_rper.m_pDatabase=&m_db;
m_selet.SetCheck(1);
// m_usename.SetBkColor(RGB(247,247,247));
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
HBRUSH CdlDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
return m_brush;
}
void CdlDlg::Ongunli()
{
// TODO: Add your control notification handler code here
kind="管理员";
}
void CdlDlg::Onyewu()
{
// TODO: Add your control notification handler code here
kind="用户";
}
void CdlDlg::Onlogin()
{
// TODO: Add your control notification handler code here
CString strsql;
UpdateData(TRUE); //将变量值读进来
strsql.Format("select * from ryxxb where Pleno='%s' AND Plepword='%s'",m_usename,m_password);
m_rper.Open(AFX_DB_USE_DEFAULT_TYPE,strsql);
//AfxMessageBox(kind);
if(m_rper.GetRecordCount()==0)
{
m_rper.Close();
AfxMessageBox("无效用户名和密码,请检查!");
m_ctrpword.SetFocus();
m_password="";
UpdateData(FALSE);
}
else if(m_rper.GetRecordCount()!=0 )
{
CString temp;
temp.Format("%s", m_rper.m_Plework);
temp.TrimRight();
if (kind.Compare(temp)==0)
{
AfxMessageBox("成功登录!");
CdlDlg::OnOK();
}
else
{
m_rper.Close();
AfxMessageBox("你无权登陆!");
UpdateData(FALSE);
}
// CdlDlg::OnOK();
}
m_rper.Close();
}
void CdlDlg::Onzhuce()
{
// TODO: Add your control notification handler code here
CregeDlg dlg;
dlg.DoModal();
CdlDlg::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -