You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
2.8 KiB
C++

// DlgAuthorityMgr->cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
//
#include "stdafx.h"
#include "LaiPuLaser.h"
#include "DlgAuthorityLogin.h"
#include "afxdialogex.h"
#include "MsgBox.h"
#include "AuthorityMgr.h"
#include "LogMgr.h"
#include "GlobalFunction.h"
IMPLEMENT_DYNAMIC(CDlgAuthorityLogin, CDialogEx)
CDlgAuthorityLogin::CDlgAuthorityLogin(CWnd* pParent /*=NULL*/)
: CDialogEx(CDlgAuthorityLogin::IDD, pParent)
{
}
CDlgAuthorityLogin::~CDlgAuthorityLogin()
{
}
void CDlgAuthorityLogin::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_NAME, m_Name);
DDX_Text(pDX, IDC_PASSWORD, m_PassWord);
DDX_Control(pDX, NEW_LOGIN_BTN, m_LoginBtn);
}
BEGIN_MESSAGE_MAP(CDlgAuthorityLogin, CDialogEx)
ON_WM_PAINT()
ON_BN_CLICKED(NEW_LOGIN_BTN, &CDlgAuthorityLogin::OnBnClickedLogin)
ON_BN_CLICKED(CHILD_SHOW_WINDOW_MIN_BTN, &CDlgAuthorityLogin::OnBnClickedShowWindowMinBtn)
END_MESSAGE_MAP()
//<2F>ػ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL CDlgAuthorityLogin::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
char c = pMsg->wParam;
if(c==VK_RETURN || c==VK_ESCAPE)
{
return TRUE;
}
}
return CDialogEx::PreTranslateMessage(pMsg);
}
void CDlgAuthorityLogin::OnCancel()
{
return;
//CDialogEx::OnCancel();
}
// CDlgAuthorityCreatAccount <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL CDlgAuthorityLogin::OnInitDialog()
{
CDialogEx::OnInitDialog();
CRect cr;
GetClientRect(&cr);
ClientToScreen(&cr);
//<2F><><EFBFBD>öԻ<C3B6><D4BB><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
MoveWindow(2 ,0,cr.Width()+20,cr.Height()+20);
m_LoginBtn.SetUpColor(RGB_GREEN);
gAuthorityMgr->Lock();
gAuthorityMgr->SetbLoginDlgOpen(true);
UpdateData(FALSE);
return TRUE;
}
void CDlgAuthorityLogin::OnPaint()
{
{
//
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD>
//
CPaintDC dc(this);
CRect rc;
GetClientRect(&rc);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpBackground;
bmpBackground.LoadBitmap(IDB_BTN_IMG123);
BITMAP bitmap;
bmpBackground.GetBitmap(&bitmap);
CBitmap* pOldBitmap = dcMem.SelectObject(&bmpBackground);
dc.StretchBlt(0,0,bitmap.bmWidth,bitmap.bmHeight, &dcMem,0,0,bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
dcMem.SelectObject(pOldBitmap);
VERIFY(dcMem.DeleteDC());
}
}
//<2F><>¼
void CDlgAuthorityLogin::OnBnClickedLogin()
{
if(!UpdateData(TRUE))
return;
if(gAuthorityMgr->Login(m_Name,m_PassWord))
{
gAuthorityMgr->SetbLoginDlgOpen(false);
OnOK();
}
}
void CDlgAuthorityLogin::OnBnClickedShowWindowMinBtn()
{
gLogMgr->WriteDebugLog("Func---->OnBnClickedShowWindowMinBtn");
GetFrame()->ShowWindowMin();
}