?? logindlg.cpp
字號:
// LoginDlg.cpp : implementation file
//
#include "stdafx.h"
#include "pro.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)
m_pwd = _T("");
m_usn = _T("");
//}}AFX_DATA_INIT
}
void CLoginDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLoginDlg)
DDX_Control(pDX, IDC_PWD, m_pwdc);
DDX_Control(pDX, IDC_USN, m_usnc);
DDX_Text(pDX, IDC_PWD, m_pwd);
DDX_Text(pDX, IDC_USN, m_usn);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLoginDlg, CDialog)
//{{AFX_MSG_MAP(CLoginDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLoginDlg message handlers
void CLoginDlg::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
void CLoginDlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData();
if(!l_db.IsOpen ())l_db.Open ();
if(l_db.IsOpen ())
{
if(!l_db.IsBOF ())l_db.MoveFirst ();
while(!l_db.IsEOF ())
{
if(l_db.m_column1 ==m_usn&&l_db.m_column2==m_pwd)
{
l_db.Close ();
OnOK();
return;
}
l_db.MoveNext ();
}
MessageBox("密碼錯誤.");
m_pwdc.SetWindowText ("");
m_pwdc.SetFocus ();
//OnOK();
return;
}
else
{
MessageBox("無法打開數據庫");
return;
}
}
BOOL CLoginDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_usnc.SetFocus();
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 + -