基本信息
源码名称:希尔密码加密、解密和破密HillCodor
源码大小:4.07M
文件格式:.rar
开发语言:C/C++
更新时间:2019-07-13
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
【调试说明】
如果提示【“iostream.h”: No such file or directory】,那么请将【#include "iostream.h"】更换为【#include <iostream> using namespace std;】
// HillCodorDlg.cpp : implementation file
//
#include "StdAfx.h"
#include "HillCodor.h"
#include "HillCodorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHillCodorDlg dialog
CHillCodorDlg::CHillCodorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CHillCodorDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CHillCodorDlg)
m_strEnMFilePath = _T("");
m_strEnEFilePath = _T("");
m_strEnKeyFilePath = _T("");
m_strEnKey = _T("");
m_strDisMFilePath = _T("");
m_strDisKeyFilePath = _T("");
m_strDisEFilePath = _T("");
m_strUnMFilePath = _T("");
m_strUnEFilePath = _T("");
m_strUnKey = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CHillCodorDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CHillCodorDlg)
DDX_Text(pDX, IDC_EN_M_FILE_PATH, m_strEnMFilePath);
DDX_Text(pDX, IDC_EN_E_FILE_PATH, m_strEnEFilePath);
DDX_Text(pDX, IDC_EN_KEY_FILE_PATH, m_strEnKeyFilePath);
DDX_Text(pDX, IDC_EN_KEY, m_strEnKey);
DDX_Text(pDX, IDC_DIS_M_FILE_PATH, m_strDisMFilePath);
DDX_Text(pDX, IDC_DIS_KEY_FILE_PATH, m_strDisKeyFilePath);
DDX_Text(pDX, IDC_DIS_E_FILE_PATH, m_strDisEFilePath);
DDX_Text(pDX, IDC_UN_M_FILE_PATH, m_strUnMFilePath);
DDX_Text(pDX, IDC_UN_E_FILE_PATH, m_strUnEFilePath);
DDX_Text(pDX, IDC_UNCODE_KEY, m_strUnKey);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CHillCodorDlg, CDialog)
//{{AFX_MSG_MAP(CHillCodorDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON_OPEN_M_FILE, OnButtonOpenMFile)
ON_BN_CLICKED(IDC_BUTTON_SAVE_E_FILE, OnButtonSaveEFile)
ON_BN_CLICKED(IDC_BUTTON_SAVE_KEY_FILE, OnButtonSaveKeyFile)
ON_BN_CLICKED(IDC_BUTTON_ENCRYPTION, OnButtonEncryption)
ON_BN_CLICKED(IDC_BUTTON_SAVE_M_FILE, OnButtonSaveMFile)
ON_BN_CLICKED(IDC_BUTTON_OPEN_E_FILE, OnButtonOpenEFile)
ON_BN_CLICKED(IDC_BUTTON_OPEN_KEY_FILE_DIS, OnButtonOpenKeyFileDis)
ON_BN_CLICKED(IDC_BUTTON_DISCRYPTION, OnButtonDiscryption)
ON_BN_CLICKED(IDC_BUTTON_GET_KEY, OnButtonGetKey)
ON_BN_CLICKED(IDC_BUTTON_OPEN_M_UN, OnButtonOpenMUn)
ON_BN_CLICKED(IDC_BUTTON_OPEN_E_UN, OnButtonOpenEUn)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHillCodorDlg message handlers
BOOL CHillCodorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CHillCodorDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CHillCodorDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon 1) / 2;
int y = (rect.Height() - cyIcon 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CHillCodorDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CHillCodorDlg::OnButtonOpenMFile()
{
// TODO: Add your control notification handler code here
// 提示选择打开文件路径
CFileDialog dlg(TRUE, "txt", m_strEnMFilePath, OFN_HIDEREADONLY,
"txt文本文件 (*.txt) | *.txt|所有文件 (*.*) | *.*||", NULL);
// 提示用户选择保存的路径
if (dlg.DoModal() != IDOK)
{
// 返回
return;
}
// 获取用户指定的文件路径
m_strEnMFilePath = dlg.GetPathName();
// 更新
UpdateData(FALSE);
}
void CHillCodorDlg::OnButtonSaveEFile()
{
// TODO: Add your control notification handler code here
// 提示选择保存文件路径
CFileDialog dlg(FALSE, "txt", m_strEnEFilePath, OFN_HIDEREADONLY,
"txt文本文件 (*.txt) | *.txt|所有文件 (*.*) | *.*||", NULL);
// 提示用户选择保存的路径
if (dlg.DoModal() != IDOK)
{
// 返回
return;
}
// 获取用户指定的文件路径
m_strEnEFilePath = dlg.GetPathName();
// 更新
UpdateData(FALSE);
}
void CHillCodorDlg::OnButtonSaveKeyFile()
{
// TODO: Add your control notification handler code here
// 提示选择保存文件路径
CFileDialog dlg(FALSE, "txt", m_strEnKeyFilePath, OFN_HIDEREADONLY,
"txt文本文件 (*.txt) | *.txt|所有文件 (*.*) | *.*||", NULL);
// 提示用户选择保存的路径
if (dlg.DoModal() != IDOK)
{
// 返回
return;
}
// 获取用户指定的文件路径
m_strEnKeyFilePath = dlg.GetPathName();
// 更新
UpdateData(FALSE);
}
void CHillCodorDlg::OnButtonEncryption()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CFile fileM; // 明文
CFileException fe;
if(!fileM.Open(m_strEnMFilePath.GetBuffer(0), CFile::modeRead, &fe))
{
CString strError = "";
strError.Format("Error!\r\nCan't open the file:%s\r\nCode: %d",
m_strEnMFilePath.GetBuffer(0), fe.m_cause);
AfxMessageBox(strError);
return;
}
CFile fileE; // 密文
if(!fileE.Open(m_strEnEFilePath.GetBuffer(0), CFile::modeWrite|CFile::modeCreate, &fe))
{
CString strError = "";
strError.Format("Error!\r\nCan't open the file:%s\r\nCode: %d",
m_strEnMFilePath.GetBuffer(0), fe.m_cause);
AfxMessageBox(strError);
return;
}
CFile fileKey; // 解密密钥文件
if(!fileKey.Open(m_strEnKeyFilePath.GetBuffer(0), CFile::modeWrite|CFile::modeCreate, &fe))
{
CString strError = "";
strError.Format("Error!\r\nCan't open the file:%s\r\nCode: %d",
m_strEnMFilePath.GetBuffer(0), fe.m_cause);
AfxMessageBox(strError);
return;
}
CHillCode codeEncryptor;
long *pEncryKey = NULL;
char * pM = NULL;
char * pE = NULL;
int nLen = m_strEnKey.GetLength(); // 块大小
int i = 0;
nLen = (int)sqrt((nLen));
pM = new char[nLen];
if(NULL == pM)
{
exit(1);
}
pE = new char[nLen];
if(NULL == pM)
{
exit(1);
}
int nKeyLen = nLen * nLen;
pEncryKey = new long[nKeyLen];
if(NULL == pEncryKey)
{
exit(1);
}
for(i=0; i<nKeyLen; i )
{
pEncryKey[i] = m_strEnKey.GetAt(i);
}
BeginWaitCursor();
// 设置密钥
if(!codeEncryptor.SetEncryKey(pEncryKey, nKeyLen))
{
MessageBox("密钥不合适,请重新输入!");
if(NULL != pEncryKey)
{
delete pEncryKey;
pEncryKey = NULL;
}
if(NULL != pM)
{
delete pM;
pM = NULL;
}
if(NULL != pE)
{
delete pE;
pE = NULL;
}
fileM.Close();
fileE.Close();
fileKey.Close();
return;
}
m_strEnKey = m_strEnKey.Left(nKeyLen);
UpdateData(FALSE);
// 写入解密密钥(一个密钥元素占4个字节)
long * pDiscryKey = NULL;
pDiscryKey = new long[nKeyLen];
if(NULL == pDiscryKey)
{
exit(1);
}
memcpy(pDiscryKey, codeEncryptor.GetDiscryptedKey(), sizeof(long) * nKeyLen);
fileKey.Write((char *)pDiscryKey, sizeof(long) * nKeyLen);
// 写入明文长度
long nMFileLen = fileM.GetLength();
fileKey.Write(&nMFileLen, sizeof(long));
// 分块循环加密
int nBlockNum = nMFileLen / nLen;
for(i=0; i<nBlockNum; i )
{
fileM.Read(pM, nLen);
codeEncryptor.SetM((const unsigned char *)pM, nLen);
memcpy(pE, codeEncryptor.Encrypting(), nLen);
fileE.Write(pE, nLen);
}
// 加密最后一块
NULL;
EndWaitCursor();
// 结束处理
if(NULL != pDiscryKey)
{
delete pDiscryKey;
pDiscryKey = NULL;
}
if(NULL != pEncryKey)
{
delete pEncryKey;
pEncryKey = NULL;
}
if(NULL != pM)
{
delete pM;
pM = NULL;
}
if(NULL != pE)
{
delete pE;
pE = NULL;
}
fileM.Close();
fileE.Close();
fileKey.Close();
}
void CHillCodorDlg::OnButtonSaveMFile()
{
// TODO: Add your control notification handler code here
// 提示选择保存文件路径
CFileDialog dlg(FALSE, "txt", m_strDisMFilePath, OFN_HIDEREADONLY,
"txt文本文件 (*.txt) | *.txt|所有文件 (*.*) | *.*||", NULL);
// 提示用户选择保存的路径
if (dlg.DoModal() != IDOK)
{
// 返回
return;
}
// 获取用户指定的文件路径
m_strDisMFilePath = dlg.GetPathName();
// 更新
UpdateData(FALSE);
}
void CHillCodorDlg::OnButtonOpenEFile()
{
// TODO: Add your control notification handler code here
// 提示选择打开文件路径
CFileDialog dlg(TRUE, "txt", m_strDisEFilePath, OFN_HIDEREADONLY,
"txt文本文件 (*.txt) | *.txt|所有文件 (*.*) | *.*||", NULL);
// 提示用户选择保存的路径
if (dlg.DoModal() != IDOK)
{
// 返回
return;
}
// 获取用户指定的文件路径
m_strDisEFilePath = dlg.GetPathName();
// 更新
UpdateData(FALSE);
}
void CHillCodorDlg::OnButtonOpenKeyFileDis()
{
// TODO: Add your control notification handler code here
// 提示选择打开文件路径
CFileDialog dlg(TRUE, "txt", m_strDisKeyFilePath, OFN_HIDEREADONLY,
"txt文本文件 (*.txt) | *.txt|所有文件 (*.*) | *.*||", NULL);
// 提示用户选择保存的路径
if (dlg.DoModal() != IDOK)
{
// 返回
return;
}
// 获取用户指定的文件路径
m_strDisKeyFilePath = dlg.GetPathName();
// 更新
UpdateData(FALSE);
}
void CHillCodorDlg::OnButtonDiscryption()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CFile fileM; // 明文
CFileException fe;
if(!fileM.Open(m_strDisMFilePath.GetBuffer(0), CFile::modeWrite|CFile::modeCreate, &fe))
{
CString strError = "";
strError.Format("Error!\r\nCan't open the file:%s\r\nCode: %d",
m_strDisMFilePath.GetBuffer(0), fe.m_cause);
AfxMessageBox(strError);
return;
}
CFile fileE; // 密文
if(!fileE.Open(m_strDisEFilePath.GetBuffer(0), CFile::modeRead, &fe))
{
CString strError = "";
strError.Format("Error!\r\nCan't open the file:%s\r\nCode: %d",
m_strDisEFilePath.GetBuffer(0), fe.m_cause);
AfxMessageBox(strError);
return;
}
CFile fileKey; // 解密密钥文件
if(!fileKey.Open(m_strDisKeyFilePath.GetBuffer(0), CFile::modeRead, &fe))
{
CString strError = "";
strError.Format("Error!\r\nCan't open the file:%s\r\nCode: %d",
m_strDisKeyFilePath.GetBuffer(0), fe.m_cause);
AfxMessageBox(strError);
return;
}
long *pDiscryKey = NULL; // 存放解密密钥
// 获取密钥长度(一个密钥元素占4个字节)
int nKeyLen = (fileKey.GetLength() - sizeof(long)) / sizeof(long);
// 获取密钥
pDiscryKey = new long[nKeyLen];
if(NULL == pDiscryKey)
{
exit(1);
}
fileKey.Read(pDiscryKey, nKeyLen*sizeof(long));
// 获取明文文件长度
int nMFileLen = 0;
fileKey.Read(&nMFileLen, sizeof(long));
// 获取解密块大小
int nBlockSize = (long)sqrt((double)nKeyLen);
if(nBlockSize*nBlockSize != nKeyLen)
{
if(NULL != pDiscryKey)
{
delete pDiscryKey;
pDiscryKey = NULL;
}
fileM.Close();
fileE.Close();
fileKey.Close();
return;
}
// 获取解密块数
int nBlockNum = fileE.GetLength() / nBlockSize;
// 分配明文块和密文块空间
char * pM = NULL; // 存放明文快
char * pE = NULL; // 存放密文块
int i = 0;
pM = new char[nBlockSize];
if(NULL == pM)
{
exit(1);
}
pE = new char[nBlockSize];
if(NULL == pE)
{
exit(1);
}
//设置解密密钥
CHillCode codeDiscryptor;
CMatrix matrixDiscryptKey(pDiscryKey, nBlockSize, nBlockSize);
codeDiscryptor.SetDiscryKey(matrixDiscryptKey);
BeginWaitCursor();
// 循环解密
for(i=0; i<nBlockNum; i )
{
fileE.Read(pE, nBlockSize);
codeDiscryptor.SetE((const unsigned char *)pE, nBlockSize);
memcpy(pM, codeDiscryptor.Discrypting(), nBlockSize);
fileM.Write(pM, nBlockSize);
}
// 处理最后一块
NULL;
EndWaitCursor();
// 结束处理
if(NULL != pE)
{
delete pE;
pE = NULL;
}
if(NULL != pM)
{
delete pM;
pM = NULL;
}
if(NULL != pDiscryKey)
{
delete pDiscryKey;
pDiscryKey = NULL;
}
fileM.Close();
fileE.Close();
fileKey.Close();
}
void CHillCodorDlg::OnButtonGetKey()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CFile fileM; // 明文
CFileException fe;
if(!fileM.Open(m_strUnMFilePath.GetBuffer(0), CFile::modeRead, &fe))
{
CString strError = "";
strError.Format("Error!\r\nCan't open the file:%s\r\nCode: %d",
m_strUnMFilePath.GetBuffer(0), fe.m_cause);
AfxMessageBox(strError);
return;
}
CFile fileE; // 密文
if(!fileE.Open(m_strUnEFilePath.GetBuffer(0), CFile::modeRead, &fe))
{
CString strError = "";
strError.Format("Error!\r\nCan't open the file:%s\r\nCode: %d",
m_strUnEFilePath.GetBuffer(0), fe.m_cause);
AfxMessageBox(strError);
return;
}
// 获取处理文件的大小
int nFileLen = (fileM.GetLength() > fileE.GetLength())? fileE.GetLength(): fileM.GetLength();
// 循环破译
long lBlockSize = 1; // 处理块的大小
long lLoop = nFileLen; // 在明文中找可逆的明文矩阵试探次数
long lKeyLen = 1; // 密钥的长度
const long BLOCK_SIZE_LIMIT = (long)sqrt(nFileLen);
BeginWaitCursor();
for(lBlockSize=1; lBlockSize<=BLOCK_SIZE_LIMIT; lBlockSize )
{
// 重置文件指针
fileM.SeekToBegin();
fileE.SeekToBegin();
// 获取猜测密文长度
lKeyLen = lBlockSize * lBlockSize;
// 初始化存储明文逆矩阵和密文矩阵
CMatrix matrixM; // 存储明文逆矩阵
CMatrix matrixE; // 存储密文矩阵
matrixM.InitMatrix(lBlockSize, lBlockSize);
matrixE.InitMatrix(lBlockSize, lBlockSize);
char * szM = new char[lKeyLen];
if(!szM)
{
exit(1);
}
char * szE = new char[lKeyLen];
if(!szE)
{
exit(1);
}
int i = 0;
lLoop = nFileLen / (lKeyLen);
// 声明密钥矩阵
CMatrix matrixKeyNew; // 存储最新获得的密钥
CMatrix matrixKeyOld; // 存储上次循环获得的密钥
for(i=0; i<lLoop; i )
{
fileM.Read(szM, sizeof(char)*lBlockSize*lBlockSize);
fileE.Read(szE, sizeof(char)*lBlockSize*lBlockSize);// 读取密文,并移动文件指针
// 初始化明文逆矩阵
int nRow = 0;
int nCol = 0;
for(nRow=0; nRow<lBlockSize; nRow )
{
for(nCol=0; nCol<lBlockSize; nCol )
{
matrixM.SetElement(nRow, nCol, (long)szM[nRow*lBlockSize nCol]);
}
}
matrixM.Transpose();
long lPhalanxValue = 0;
lPhalanxValue = matrixM.GetPhalanxValue();
if(!lPhalanxValue || !(lPhalanxValue%2))
{
continue;
}
matrixM.Adjoint();
matrixM = matrixM * Reciprocal(lPhalanxValue);
matrixM.Mod(MAPLEN);
// 初始化密文矩阵
for(nRow=0; nRow<lBlockSize; nRow )
{
for(nCol=0; nCol<lBlockSize; nCol )
{
matrixE.SetElement(nRow, nCol, (long)szE[nRow*lBlockSize nCol]);
}
}
matrixE.Transpose();
// 获取新密钥
matrixKeyNew = matrixE * matrixM;
matrixKeyNew.Mod(MAPLEN);
// 判断是否和上次求得的密钥是否相同
if(matrixKeyOld.IsEmpty())
{
matrixKeyOld = matrixKeyNew;
}
else if(!(matrixKeyOld == matrixKeyNew))
{// 该密钥长度是错误的
break;
}
}
if(szM)
{
delete szM;
szM = NULL;
}
if(szE)
{
delete szE;
szE = NULL;
}
// 显示密钥
if(!matrixKeyOld.IsEmpty() && !matrixKeyNew.IsEmpty() && matrixKeyOld == matrixKeyNew)
{
long lValue = 0;
int j = 0;
char * szKey = new char[lKeyLen 1];
if(!szKey)
{
exit(1);
}
memset(szKey, 0, lKeyLen 1);
for(i=0; i<lBlockSize; i )
{
for(j=0; j<lBlockSize; j )
{
matrixKeyNew.GetElement(i, j, lValue);
szKey[i*lBlockSize j] = (char)lValue;
}
}
m_strUnKey = szKey;
UpdateData(FALSE);
if(szKey)
{
delete szKey;
szKey = NULL;
}
break;
}
}
EndWaitCursor();
// 结束处理
fileM.Close();
fileE.Close();
}
void CHillCodorDlg::OnButtonOpenMUn()
{
// TODO: Add your control notification handler code here
// 提示选择打开文件路径
CFileDialog dlg(TRUE, "txt", m_strUnMFilePath, OFN_HIDEREADONLY,
"txt文本文件 (*.txt) | *.txt|所有文件 (*.*) | *.*||", NULL);
// 提示用户选择保存的路径
if (dlg.DoModal() != IDOK)
{
// 返回
return;
}
// 获取用户指定的文件路径
m_strUnMFilePath = dlg.GetPathName();
// 更新
UpdateData(FALSE);
}
void CHillCodorDlg::OnButtonOpenEUn()
{
// TODO: Add your control notification handler code here
// 提示选择打开文件路径
CFileDialog dlg(TRUE, "txt", m_strUnEFilePath, OFN_HIDEREADONLY,
"txt文本文件 (*.txt) | *.txt|所有文件 (*.*) | *.*||", NULL);
// 提示用户选择保存的路径
if (dlg.DoModal() != IDOK)
{
// 返回
return;
}
// 获取用户指定的文件路径
m_strUnEFilePath = dlg.GetPathName();
// 更新
UpdateData(FALSE);
}