?? optionsdlg.cpp
字號(hào):
// OptionsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FileCipher.h"
#include "OptionsDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COptionsDlg dialog
COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/)
: CDialog(COptionsDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COptionsDlg)
m_strKey = _T("");
m_nEncrpty = 0;
m_nFunType = 0;
m_nProcType = 0;
//}}AFX_DATA_INIT
}
void COptionsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptionsDlg)
DDX_Control(pDX, IDC_SLIDER1, m_PerSlider);
DDX_Text(pDX, IDC_KEY, m_strKey);
DDV_MaxChars(pDX, m_strKey, 8);
DDX_Radio(pDX, IDC_RADIO1, m_nEncrpty);
DDX_Radio(pDX, IDC_RADIO3, m_nFunType);
DDX_Radio(pDX, IDC_RADIO6, m_nProcType);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptionsDlg, CDialog)
//{{AFX_MSG_MAP(COptionsDlg)
ON_WM_HSCROLL()
ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COptionsDlg message handlers
BOOL COptionsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
InitAll();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COptionsDlg::InitAll()
{
m_nPerPos=g_zOptions.fProcPercent;
m_PerSlider.SetRange(0,100);
m_strKey.Format("%s",g_zOptions.key);
m_nEncrpty=g_zOptions.bIsEncrpty;
m_nProcType=g_zOptions.bIsProcEachBlock;
m_nFunType=(int)g_zOptions.zFunType;
UpdateData(FALSE);
UpdateInfo();
}
void COptionsDlg::OnOK()
{ UpdateData(TRUE);
if(m_strKey.GetLength()>8)
{ AfxMessageBox("密鑰不能超過8個(gè)字符");
return;
}
//m_strKey.Format("%s",g_zOptions.key);
sprintf((char*)g_zOptions.key,"%s",m_strKey);
// g_zOptions.bIsEncrpty=m_nEncrpty;
g_zOptions.bIsProcEachBlock=m_nProcType;
g_zOptions.zFunType=(CipherFunType)m_nFunType ;
g_zOptions.fProcPercent=m_nPerPos;
CDialog::OnOK();
}
void COptionsDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CSliderCtrl * pSlider=(CSliderCtrl *)pScrollBar;
switch(pScrollBar->GetDlgCtrlID()){
case IDC_SLIDER1:
m_nPerPos=pSlider->GetPos();
UpdateInfo();
break;
default:
break;
}
UpdateData(FALSE);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void COptionsDlg::UpdateInfo()
{ char szbuff[64];
m_PerSlider.SetPos(m_nPerPos);
sprintf(szbuff,"加密比例 %d %%",m_nPerPos );
SetDlgItemText(IDC_STATIC_PER,szbuff);
}
void COptionsDlg::OnRadio3()
{
m_nFunType=0;
}
void COptionsDlg::OnRadio4()
{
m_nFunType=1;
}
void COptionsDlg::OnRadio6()
{
m_nProcType=0;
}
void COptionsDlg::OnRadio7()
{
m_nProcType=1;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -