📄 zipdll.cpp
字号:
// ZipDll.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "ZipDll.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CZipDllApp
BEGIN_MESSAGE_MAP(CZipDllApp, CWinApp)
//{{AFX_MSG_MAP(CZipDllApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CZipDllApp construction
CZipDllApp::CZipDllApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CZipDllApp object
CZipDllApp theApp;
extern "C" BOOL PASCAL EXPORT Ex_Zip(LPCTSTR lpszFilePath, LPCTSTR lpszDestPath)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ZipUtil_CPP ZipUtil;
if (ZipUtil.zip(lpszFilePath, lpszDestPath) != 0)
{
return FALSE;
}
return TRUE;
}
extern "C" BOOL PASCAL EXPORT Ex_UnZip(LPCTSTR lpszDestFolder, LPCTSTR lpszFileName)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ZipUtil_CPP ZipUtil;
//为空表示要解压ZIP文件中所有的文件
CString szFileName("");
//参数TRUE表示保持原所有路径
if (ZipUtil.unzip(lpszFileName, lpszDestFolder, TRUE, szFileName) != 0 )
{
szFileName = lpszFileName;
AfxGetMainWnd()->MessageBox("读文件 " + szFileName + " 出错!", "错误", MB_ICONERROR);
return FALSE;
}
return TRUE;
}
/*
//**为空表示要解压ZIP文件中所有的文件
CString szFileName = _T("");
LPCTSTR lpszFileName = strWinText;
CString szFilePath = "c:\\";
//**参数TRUE表示保持原所有路径
if ( ZipUtil.unzip(lpszFileName,szFilePath,TRUE ,szFileName) != 0 ){
szFileName = lpszFileName;
AfxGetMainWnd()->MessageBox("读文件 " + szFileName + " 出错!","错误",MB_ICONERROR);
return;
}
//return g_WorkPath + "ICTMP\\" + szFileName;
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -