下载地址:http://www.7-zip.org/download.html 【注意 下载这个】Download .tar.bz2 Any 7-Zip Source code 编译出7z.dll后 用7z.exe测试一下 , 注意放同一目录 命令行方式运行 7z.exe a zip xxx.zip *.dll 如果出现 everything is ok 则说明此dll可用。
m_pFile->QueryInfo(HTTP_QUERY_CONTENT_ENCODING,rString,NULL); m_pFile->QueryInfo(HTTP_QUERY_CONTENT_LENGTH,conlen_s,NULL); if(rString.MakeLower()=="gzip") isGzipUrl=TRUE; CInternetSession* Session = new CInternetSession();
【注意 下载这个】Download .tar.bz2 Any 7-Zip Source code
编译出7z.dll后 用7z.exe测试一下 , 注意放同一目录 命令行方式运行
7z.exe a zip xxx.zip *.dll
如果出现 everything is ok 则说明此dll可用。
m_pFile->QueryInfo(HTTP_QUERY_CONTENT_LENGTH,conlen_s,NULL);
if(rString.MakeLower()=="gzip") isGzipUrl=TRUE; CInternetSession* Session = new CInternetSession();
CHttpFile* HTTPFile;
//HTTPFile =(CHttpFile*)Session-> OpenURL(pThreadParams->m_pszURL);
HTTPFile =(CHttpFile*)Session-> OpenURL(pThreadParams->m_pszURL,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD|INTERNET_FLAG_DONT_CACHE); HTTPFile->Read(buf,nBytes);
Session->Close();
#ifdef _UNICODE
ZIPENTRYW ze;
#else
ZIPENTRY ze;
#endif
// from a file (by name): OpenZip("c:\\test.zip",0, ZIP_FILENAME);
TCHAR * pszName0 = _T("1.zip");
TCHAR * pszName1 = _T("5");HZIP hz;
hz=OpenZip(pszName0, 0, ZIP_FILENAME);if (hz)
{
AfxMessageBox(" Open Zip ==> OK"); ZRESULT zr = GetZipItem(hz, -1, &ze); if (zr == ZR_OK)
{
int numitems = ze.index; if (numitems == 1)
{
//m_List.Printf(CXListBox::Green, CXListBox::White, 0,
// _T(" Zip archive contains 1 file ==> OK"));
AfxMessageBox(" Zip archive contains 1 file ==> OK"); memset(&ze, 0, sizeof(ze));
int index = -1;
ZRESULT zr = 0; zr = FindZipItem(hz, lpszFile, TRUE, &index, &ze); CloseZip(hz);
}
else
{
//m_List.Printf(CXListBox::Red, CXListBox::White, 0,
// _T(" Zip contents bad"));
}
}
else
{
//m_List.Printf(CXListBox::Red, CXListBox::White, 0,
// _T(" GetZipItem failed"));
}
}
else
{
//m_List.Printf(CXListBox::Red, CXListBox::White, 0,
// _T(" Failed to open zip file '%s'"), pszArchive1);
AfxMessageBox(" Zip archive contains 1 file ==> error");
}打开它自已生成的ZIP文件是可以的,但打开别的就是不行,研究了一天了,也没有搞定
这个库可以满足你的要求