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

📄 chgplacedlg.cpp

📁 .net2003下写的多种加密加密算法的演示
💻 CPP
字号:
// CHGPlaceDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "LmCrypt.h"
#include "CHGPlaceDlg.h"
#include ".\chgplacedlg.h"
#include ".\changeplace.h"

// CCHGPlaceDlg 对话框

IMPLEMENT_DYNAMIC(CCHGPlaceDlg, CDialog)
CCHGPlaceDlg::CCHGPlaceDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCHGPlaceDlg::IDD, pParent)
	, i_hang(0)
	, i_lie(0)
	, list_sel(0)
	, sel_sel(0)
{
	DocLeft.RemoveAll();
	DocSel.RemoveAll();
}

CCHGPlaceDlg::~CCHGPlaceDlg()
{
}

void CCHGPlaceDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_CBIndex(pDX, IDC_COMBO_HANG, i_hang);
	DDX_CBIndex(pDX, IDC_COMBO_LIE, i_lie);
	DDX_Control(pDX, IDC_COMBO_HANG, cb_hang);
	DDX_Control(pDX, IDC_COMBO_LIE, cb_lie);
	DDX_Control(pDX, IDC_LIST_DOC, lb_list);
	DDX_Control(pDX, IDC_LIST_SEL, lb_sel);
	DDX_LBIndex(pDX, IDC_LIST_DOC, list_sel);
	DDX_LBIndex(pDX, IDC_LIST_SEL, sel_sel);
}


BEGIN_MESSAGE_MAP(CCHGPlaceDlg, CDialog)
	ON_BN_CLICKED(IDOK, OnBnClickedOk)
	ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
END_MESSAGE_MAP()


// CCHGPlaceDlg 消息处理程序

BOOL CCHGPlaceDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	CDocManager * p_docm=::AfxGetApp()->m_pDocManager;

	   //p_docm->
	   //::AfxGetMainWnd()->get
	
	POSITION pos= ::AfxGetApp()->GetFirstDocTemplatePosition(); 
	 CDocTemplate *pTemplate = ::AfxGetApp()->GetNextDocTemplate(pos);
	 POSITION pos_doc;
     CDocument* m_doc;
	 int i_doccount=p_docm->GetOpenDocumentCount();
	pos_doc=pTemplate->GetFirstDocPosition();
	for(int j=0;j<i_doccount;j++){
	m_doc=pTemplate->GetNextDoc(pos_doc);
	//m_doclist[j]=m_doc;
	
	//CListBox * p_listdoc=(CListBox *)GetDlgItem(IDC_LIST_DOC);
	lb_list.AddString(m_doc->GetTitle());
	DocLeft.Add((CObject*)m_doc);
		//s_doc=pTemplate->GetNextDoc();
	}
	 

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}

void CCHGPlaceDlg::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	
//	CDocument* m_subdoc=m_doclist[0];
	int i_doccount=DocSel.GetCount();
	for(int i=0;i<i_doccount;i++)
	{
		CDocument* m_subdoc=(CDocument*)DocSel.GetAt(i);
	
	CString str_path=m_subdoc->GetPathName();
	UpdateData(true);
	//CComboBox *cb=(CComboBox*)GetDlgItem(IDC_COMBO_HANG);
	CString str_hang="";
	cb_hang.GetLBText(i_hang,str_hang);
	CString str_lie="";
	cb_lie.GetLBText(i_lie,str_lie);
	char ch_hang=str_hang.GetAt(0);
	char ch_lie=str_lie.GetAt(0);
	int hang=ch_hang-'0';
	int lie=ch_lie-'0';
	CChangePlace ch;
	ch.EncrypChgPl(hang,lie,str_path);

	}
	OnOK();
}

void CCHGPlaceDlg::OnBnClickedButton1()
{
	UpdateData(true);
	if(lb_list.GetCount()<1||list_sel>=lb_list.GetCount()||list_sel<0)
		return;
	
	CString str_title;
	lb_list.GetText(list_sel,str_title);
	lb_sel.AddString(str_title);
	
	DocSel.Add(DocLeft.GetAt(list_sel));
	DocLeft.RemoveAt(list_sel);
    lb_list.DeleteString(list_sel);
	UpdateData(true);
}

void CCHGPlaceDlg::OnBnClickedButton2()
{
	UpdateData(true);
	if(lb_sel.GetCount()<1||sel_sel>=lb_sel.GetCount()||sel_sel<0)
		return;
	
	CString str_title;
	lb_sel.GetText(sel_sel,str_title);
	lb_list.AddString(str_title);
	
	DocLeft.Add(DocSel.GetAt(sel_sel));
	DocSel.RemoveAt(sel_sel);

	lb_sel.DeleteString(sel_sel);
	UpdateData(true);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -