?? loginfrm.cpp
字號:
// Loginfrm.cpp : 實現文件
//
#include "stdafx.h"
#include "ProjectManage.h"
#include "Loginfrm.h"
#include "User.h"
// CLoginfrm 對話框
IMPLEMENT_DYNAMIC(CLoginfrm, CDialog)
CLoginfrm::CLoginfrm(CWnd* pParent /*=NULL*/)
: CDialog(CLoginfrm::IDD, pParent)
{
}
CLoginfrm::~CLoginfrm()
{
}
void CLoginfrm::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CLoginfrm, CDialog)
ON_BN_CLICKED(IDC_OK, &CLoginfrm::OnBnClickedOk)
ON_BN_CLICKED(IDC_CANCEL, &CLoginfrm::OnBnClickedCancel)
END_MESSAGE_MAP()
// CLoginfrm 消息處理程序
void CLoginfrm::OnBnClickedOk()
{
// TODO: 在此添加控件通知處理程序代碼
CEdit* pEdit=(CEdit*) this->GetDlgItem(IDC_EDIT2);
CComboBox* pCombobox=(CComboBox*) this->GetDlgItem(IDC_COMBO1);
CString username,password;
pEdit->GetWindowText(password);
pCombobox->GetWindowText(username);
if(!theApp.m_pUser->Check(username,password))
{
//AfxMessageBox("密碼錯誤,請重新輸入!");
MessageBox("密碼錯誤,請重新輸入","秘碼錯誤",MB_OK|MB_ICONWARNING);
pEdit->SetWindowText("");
pEdit->SetFocus();
}
else
{
OnOK();
}
}
void CLoginfrm::OnBnClickedCancel()
{
// TODO: 在此添加控件通知處理程序代碼
if(MessageBox(_T("真的要退出系統嗎?"),_T("退出詢問"),MB_OKCANCEL|MB_ICONQUESTION)==IDOK)
OnCancel();
}
BOOL CLoginfrm::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加額外的初始化
CString name;
CComboBox* pCombobox=(CComboBox*) this->GetDlgItem(IDC_COMBO1);
theApp.m_pUser->GetUserNames();
POSITION p=theApp.m_pUser->m_NameList.GetHeadPosition();
while(p)
{
name=theApp.m_pUser->m_NameList.GetNext(p);
pCombobox->AddString(name);
}
pCombobox->SetCurSel(0);
CEdit* pEdit=(CEdit*) this->GetDlgItem(IDC_EDIT2);
pEdit->SetWindowText("");
pEdit->SetFocus();
return TRUE; // return TRUE unless you set the focus to a control
// 異常: OCX 屬性頁應返回 FALSE
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -