📄 logindlg.cpp
字号:
// LoginDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "FileGuard.h"
#include "FileGuardApp.h"
#include "MainFrm.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_strPwd = _T("");
//}}AFX_DATA_INIT
bLogin=FALSE;
}
void CLoginDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLoginDlg)
DDX_Text(pDX, IDC_PWD, m_strPwd);
DDV_MaxChars(pDX, m_strPwd, 10);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLoginDlg, CDialog)
//{{AFX_MSG_MAP(CLoginDlg)
ON_BN_CLICKED(IDOK, OnOk)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLoginDlg message handlers
void CLoginDlg::OnOk()
{
char lpszCipher1[CIPHER_LEN], lpszCipher2[CIPHER_LEN];
UpdateData();
GetCipher(lpszCipher1);
Encrypt(lpszCipher2, m_strPwd);
if(strcmp(lpszCipher1, lpszCipher2))
{
bLogin=FALSE;
AfxMessageBox("密码错误!", MB_OK|MB_ICONSTOP);
return;
}
else
{
bLogin=TRUE;
if(!bActAppUp && !(bSysStartUp && bActSysUp))
((CMainFrame *)AfxGetMainWnd())->OnPauseProtection();
}
CDialog::OnOK();
}
BOOL CLoginDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
GetDlgItem(IDC_PWD)->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 + -