setdlg.cpp
来自「基于Triple DES的文件加密,可以对任意文件进行加密」· C++ 代码 · 共 83 行
CPP
83 行
// SetDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FES.h"
#include "SetDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetDlg dialog
CSetDlg::CSetDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSetDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetDlg)
m_Key = _T("");
//}}AFX_DATA_INIT
}
void CSetDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetDlg)
DDX_Text(pDX, IDC_EDIT_KEY, m_Key);
DDV_MaxChars(pDX, m_Key, 16);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetDlg, CDialog)
//{{AFX_MSG_MAP(CSetDlg)
ON_BN_CLICKED(IDC_CHECK_VISIBLE, OnCheckVisible)
ON_BN_CLICKED(IDC_STATIC_VISIBLE, OnStaticVisible)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetDlg message handlers
void CSetDlg::OnOK()
{
// TODO: Add extra validation here
extern char key[16];
UpdateData();
if( m_Key.GetLength() <8 )
MessageBox("密码长度在8-16之间!","错误");
else
{
::strcpy(key, (char *)(LPCSTR)m_Key);
EndDialog(IDOK);
}
}
void CSetDlg::OnCheckVisible()
{
// TODO: Add your control notification handler code here
CEdit * edit=(CEdit *)GetDlgItem(IDC_EDIT_KEY);
if(edit->GetPasswordChar()=='*')
edit->SetPasswordChar(0);
else
edit->SetPasswordChar('*');
}
void CSetDlg::OnStaticVisible()
{
// TODO: Add your control notification handler code here
CButton *chk=(CButton *)GetDlgItem(IDC_CHECK_VISIBLE);
if(chk->GetCheck()!=1)
chk->SetCheck(1);
else
chk->SetCheck(0);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?