📄 mobilclient_landing.cpp
字号:
// MobilClient_Landing.cpp : implementation file
//
#include "stdafx.h"
#include "DataBaseSoftWare.h"
#include "MobilClient_Landing.h"
#include "ModifyKey.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern bool LandingYesOrnot;
CBrush m_brBk;//
/////////////////////////////////////////////////////////////////////////////
// MobilClient_Landing dialog
MobilClient_Landing::MobilClient_Landing(CWnd* pParent /*=NULL*/)
: CDialog(MobilClient_Landing::IDD, pParent)
{
//{{AFX_DATA_INIT(MobilClient_Landing)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void MobilClient_Landing::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MobilClient_Landing)
DDX_Control(pDX, IDC_BUTTON_ModifyKey, m_modifykey);
DDX_Control(pDX, IDC_BUTTON_LandingCancel, m_landingcancel);
DDX_Control(pDX, IDC_BUTTON_Landing, m_landing);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(MobilClient_Landing, CDialog)
//{{AFX_MSG_MAP(MobilClient_Landing)
ON_BN_CLICKED(IDC_BUTTON_Landing, OnBUTTONLanding)
ON_BN_CLICKED(IDC_BUTTON_ModifyKey, OnBUTTONModifyKey)
ON_BN_CLICKED(IDC_CHECK_Landing, OnCHECKLanding)
ON_BN_CLICKED(IDC_CHECK_SaveLanding, OnCHECKSaveLanding)
ON_BN_CLICKED(IDC_BUTTON_LandingCancel, OnBUTTONLandingCancel)
ON_WM_CTLCOLOR()
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// MobilClient_Landing message handlers
BOOL MobilClient_Landing::OnInitDialog()
{
CDialog::OnInitDialog();
CString strL,strU,strP;
::GetProfileString("DefaultLanding","admin","DefaultLanding" ,
strL.GetBuffer(100),100);
if(strL=="TRUE")
{
((CButton *)GetDlgItem(IDC_CHECK_Landing))->SetCheck(TRUE);//选上
//从配置文件中读出默认信息
::GetProfileString("UserName","admin","m_UserName" ,
strU.GetBuffer(100),100);
::GetProfileString("PassWord","admin","m_PassWord" ,
strP.GetBuffer(100),100);
GetDlgItem(IDC_EDIT_AssistantName)->SetWindowText(strU);
GetDlgItem(IDC_RICHEDIT_AssistantKey)->SetWindowText(strP);
GetDlgItem(IDC_EDIT_AssistantName)->EnableWindow(FALSE);
GetDlgItem(IDC_RICHEDIT_AssistantKey)->EnableWindow(FALSE);
GetDlgItem(IDC_CHECK_SaveLanding)->EnableWindow(TRUE);
}
return TRUE;
}
void MobilClient_Landing::OnBUTTONLanding()
{
// TODO: Add your control notification handler code here
GetDlgItem(IDC_RICHEDIT_AssistantKey)->GetWindowText(m_PassWord);
GetDlgItem(IDC_EDIT_AssistantName)->GetWindowText(m_UserName);
CString strL,strU,strP,strIP;
strL="";
::GetProfileString("DefaultLanding","admin","DefaultLanding" ,
strL.GetBuffer(100),100);
int isp;
int isn;
if(strL=="TRUE")
{
//从配置文件中读出默认信息
::GetProfileString("UserName","admin","m_UserName" ,
strU.GetBuffer(100),100);
::GetProfileString("PassWord","admin","m_PassWord" ,
strP.GetBuffer(100),100);
isp=strcmp(m_UserName,strU);
isn=strcmp(m_PassWord,strP);
}
else
{
isp=strcmp(m_UserName,"水平心");
isn=strcmp(m_PassWord,"sy800424");
::WriteProfileString("UserName","admin",m_UserName);
::WriteProfileString("PassWord","admin",m_PassWord);
::WriteProfileString("DefaultLanding","admin","TRUE");
}
if(isp==0&&isn==0)
{
LandingYesOrnot=TRUE;
this->OnOK();
}
}
void MobilClient_Landing::OnBUTTONModifyKey()
{
// TODO: Add your control notification handler code here
ModifyKey ModifyKey;
ModifyKey.DoModal();
}
BOOL MobilClient_Landing::OnEraseBkgnd(CDC* pDC)
{
CPaintDC dc(this);
CRect rect;
GetWindowRect(&rect);
CDC memDC;
CBitmap cBitmap;
CBitmap* pOldMemBmp=NULL;
cBitmap.LoadBitmap(IDB_BITMAP1);
memDC.CreateCompatibleDC(&dc);
pOldMemBmp=memDC.SelectObject(&cBitmap);
dc.BitBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,SRCCOPY);
memDC.SelectObject(pOldMemBmp);
return TRUE;
}
void MobilClient_Landing::OnCHECKLanding()
{
// TODO: Add your control notification handler code here
if(m_DefaultLanding==TRUE)
{
m_DefaultLanding=FALSE;
// GetDlgItem(IDC_DBCOMBO_ServerAddress)->EnableWindow(TRUE);
// GetDlgItem(IDC_EDIT_AssistantName)->EnableWindow(TRUE);
// GetDlgItem(IDC_RICHEDIT_AssistantKey)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT_AssistantName)->EnableWindow(FALSE);
GetDlgItem(IDC_RICHEDIT_AssistantKey)->EnableWindow(FALSE);
GetDlgItem(IDC_CHECK_SaveLanding)->EnableWindow(TRUE);
m_PassWord="";
}
else
{
m_DefaultLanding=TRUE;
((CButton *)GetDlgItem(IDC_CHECK_SaveLanding))->SetCheck(FALSE);
GetDlgItem(IDC_EDIT_AssistantName)->EnableWindow(TRUE);
GetDlgItem(IDC_RICHEDIT_AssistantKey)->EnableWindow(TRUE);
CString strL,strU,strP,strIP;
::GetProfileString("DefaultLanding","admin","DefaultLanding" ,
strL.GetBuffer(100),100);
if(strL=="TRUE")
{
//从配置文件中读出默认信息
::GetProfileString("UserName","admin","m_UserName" ,
strU.GetBuffer(100),100);
::GetProfileString("PassWord","admin","m_PassWord" ,
strP.GetBuffer(100),100);
GetDlgItem(IDC_EDIT_AssistantName)->SetWindowText(strU);
GetDlgItem(IDC_RICHEDIT_AssistantKey)->SetWindowText(strP);
// GetDlgItem(IDC_DBCOMBO_ServerAddress)->EnableWindow(FALSE);
// GetDlgItem(IDC_EDIT_AssistantName)->EnableWindow(FALSE);
// GetDlgItem(IDC_RICHEDIT_AssistantKey)->EnableWindow(FALSE);
}
else
MessageBox("您还没有设置默认用户名和密码!");
}
}
void MobilClient_Landing::OnCHECKSaveLanding()
{
// TODO: Add your control notification handler code here
if(m_SaveLanding)
{
m_SaveLanding=FALSE;
GetDlgItem(IDC_CHECK_Landing)->EnableWindow(TRUE);
issave=0;
}
else
{
m_SaveLanding=TRUE;
issave=1;
GetDlgItem(IDC_CHECK_Landing)->EnableWindow(FALSE);
}
}
void MobilClient_Landing::OnBUTTONLandingCancel()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
HBRUSH MobilClient_Landing::OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor)
{
if (pWnd == this)
{
return m_brBk;
}
CBrush m_brBkgnd(RGB(234,198,219));
CBrush m_brControlBkgnd2(RGB(0,255,0));
CBrush m_ipbrBkgnd(RGB(0,0,255));
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
CBrush m_clrText(RGB(234,198,219));
if(nCtlColor == CTLCOLOR_STATIC)//对话框:CTLCOLOR_DLG 按钮:CTLCOLOR_BTN
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT); //设置背景透明
return HBRUSH(GetStockObject(HOLLOW_BRUSH));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -