⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checkpassworddlg.cpp

📁 远程视频监控系统最新程序代码
💻 CPP
字号:
// CheckPasswordDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Operat.h"
#include "CheckPasswordDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCheckPasswordDlg dialog


CCheckPasswordDlg::CCheckPasswordDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCheckPasswordDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCheckPasswordDlg)
	m_nPassword = _T("");
	//}}AFX_DATA_INIT
}


void CCheckPasswordDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCheckPasswordDlg)
	DDX_Text(pDX, IDC_EDIT_PASSWORD, m_nPassword);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCheckPasswordDlg, CDialog)
	//{{AFX_MSG_MAP(CCheckPasswordDlg)
	ON_BN_CLICKED(IDC_BUTTON_ONE, OnButtonOne)
	ON_BN_CLICKED(IDC_BUTTON_TWO, OnButtonTwo)
	ON_BN_CLICKED(IDC_BUTTON_THREE, OnButtonThree)
	ON_BN_CLICKED(IDC_BUTTON_FOUR, OnButtonFour)
	ON_BN_CLICKED(IDC_BUTTON_FIVE, OnButtonFive)
	ON_BN_CLICKED(IDC_BUTTON_SIX, OnButtonSix)
	ON_BN_CLICKED(IDC_BUTTON_SEVEN, OnButtonSeven)
	ON_BN_CLICKED(IDC_BUTTON_EIGHT, OnButtonEight)
	ON_BN_CLICKED(IDC_BUTTON_NINE, OnButtonNine)
	ON_BN_CLICKED(IDC_BUTTON_ZERO, OnButtonZero)
	ON_BN_CLICKED(IDC_BUTTON_BACK, OnButtonBack)
	ON_BN_CLICKED(IDC_BUTTON_A, OnButtonA)
	ON_BN_CLICKED(IDC_BUTTON_B, OnButtonB)
	ON_BN_CLICKED(IDC_BUTTON_C, OnButtonC)
	ON_BN_CLICKED(IDC_BUTTON_D, OnButtonD)
	ON_BN_CLICKED(IDC_BUTTON_E, OnButtonE)
	ON_BN_CLICKED(IDC_BUTTON_F, OnButtonF)
	ON_BN_CLICKED(IDC_BUTTON_G, OnButtonG)
	ON_BN_CLICKED(IDC_BUTTON_H, OnButtonH)
	ON_BN_CLICKED(IDC_BUTTON_I, OnButtonI)
	ON_BN_CLICKED(IDC_BUTTON_J, OnButtonJ)
	ON_BN_CLICKED(IDC_BUTTON_K, OnButtonK)
	ON_BN_CLICKED(IDC_BUTTON_L, OnButtonL)
	ON_BN_CLICKED(IDC_BUTTON_M, OnButtonM)
	ON_BN_CLICKED(IDC_BUTTON_N, OnButtonN)
	ON_BN_CLICKED(IDC_BUTTON_O, OnButtonO)
	ON_BN_CLICKED(IDC_BUTTON_P, OnButtonP)
	ON_BN_CLICKED(IDC_BUTTON_Q, OnButtonQ)
	ON_BN_CLICKED(IDC_BUTTON_R, OnButtonR)
	ON_BN_CLICKED(IDC_BUTTON_S, OnButtonS)
	ON_BN_CLICKED(IDC_BUTTON_T, OnButtonT)
	ON_BN_CLICKED(IDC_BUTTON_U, OnButtonU)
	ON_BN_CLICKED(IDC_BUTTON_V, OnButtonV)
	ON_BN_CLICKED(IDC_BUTTON_W, OnButtonW)
	ON_BN_CLICKED(IDC_BUTTON_X, OnButtonX)
	ON_BN_CLICKED(IDC_BUTTON_Y, OnButtonY)
	ON_BN_CLICKED(IDC_BUTTON_Z, OnButtonZ)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCheckPasswordDlg message handlers

void CCheckPasswordDlg::OnButtonOne() 
{
	// TODO: Add your control notification handler code here
    m_nPassword+="1";
	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonTwo() 
{
	// TODO: Add your control notification handler code here
	    m_nPassword+="2";
			UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonThree() 
{
	// TODO: Add your control notification handler code here
	    m_nPassword+="3";
			UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonFour() 
{
	// TODO: Add your control notification handler code here
	m_nPassword+="4";
		UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonFive() 
{
	// TODO: Add your control notification handler code here
   	    m_nPassword+="5";	
	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonSix() 
{
	// TODO: Add your control notification handler code here
    m_nPassword+="6";
	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonSeven() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="7";
	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonEight() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="8";
	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonNine() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="9";
	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonZero() 
{
	// TODO: Add your control notification handler code here
    m_nPassword+="0";
	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonBack() 
{
	// TODO: Add your control notification handler code here
	CString nStr;
	if(m_nPassword.GetLength()<=0) return;
	m_nPassword.SetAt(m_nPassword.GetLength()-1,0x20);
	m_nPassword.TrimRight();
	/*
	for(int i=0;i<;i++)
	{
		nStr.SetAt(i,m_nPassword.GetAt(i));
	}
	m_nPassword=nStr;
	*/
	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonA() 
{
	// TODO: Add your control notification handler code here
	m_nPassword+="A";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonB() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="B";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonC() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="C";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonD() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="D";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonE() 
{
	// TODO: Add your control notification handler code here
	    m_nPassword+="E";		UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonF() 
{
	// TODO: Add your control notification handler code here
	    m_nPassword+="F";		UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonG() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="G";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonH() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="H";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonI() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="I";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonJ() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="J";	UpdateData(FALSE);
	
}

void CCheckPasswordDlg::OnButtonK() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="K";	UpdateData(FALSE);
	
}

void CCheckPasswordDlg::OnButtonL() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="L";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonM() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="M";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonN() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="N";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonO() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="O";	UpdateData(FALSE);
	
}

void CCheckPasswordDlg::OnButtonP() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="P";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonQ() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="Q";	UpdateData(FALSE);
	
}

void CCheckPasswordDlg::OnButtonR() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="R";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonS() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="S";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonT() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="T";	UpdateData(FALSE);
	
}

void CCheckPasswordDlg::OnButtonU() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="U";	UpdateData(FALSE);
	
}

void CCheckPasswordDlg::OnButtonV() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="V";	UpdateData(FALSE);
	
}

void CCheckPasswordDlg::OnButtonW() 
{
	// TODO: Add your control notification handler code here
		    m_nPassword+="W";	UpdateData(FALSE);
	
}

void CCheckPasswordDlg::OnButtonX() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="X";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnButtonY() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="Y";	UpdateData(FALSE);
}

void CCheckPasswordDlg::OnButtonZ() 
{
	// TODO: Add your control notification handler code here
			    m_nPassword+="Z";	UpdateData(FALSE);

}

void CCheckPasswordDlg::OnOK() 
{
	// TODO: Add extra validation here
	CString nStr;
	nStr.Format("%s",m_nOldPassword);
	UpdateData(TRUE);
	if (nStr.CompareNoCase(m_nPassword)) 
	{
		AfxMessageBox("密码错误,请重新输入");
		return;
	}
	CDialog::OnOK();
}

BOOL CCheckPasswordDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	FILE *ftpA;
	m_nOldPassword[0]=0;
	if ((ftpA=fopen(".\\table\\password.txt","r+"))!=NULL)
	{
		fscanf(ftpA,"%40s",m_nOldPassword);
		fclose(ftpA);
	}

	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 + -