/**/ /打包函数// // 只能打包同一目录下的所有文件,暂不支持文件夹的打包 // / void CPackDlg::OnPack() ... { // TODO: Add your control notification handler code here m_nShowInfo=PACKID; m_nShowInfo+=" "; char strPackID[]=PACKID; tmp.Format("正在打包当前目录下的文件到打包文件%s中... ",PACKNAME); ShowInfo(tmp); CFile file(PACKNAME,CFile::modeWrite|CFile::modeCreate); file.Write(strPackID,sizeof(PACKID)-1); TCHAR szPath[MAX_PATH]; ::GetCurrentDirectory (sizeof (szPath) / sizeof (TCHAR), szPath); CString strPath = szPath; if (strPath.Right (1) != _T ("/")) strPath += _T ("/"); strPath += _T ("*.*"); HANDLE hFind; WIN32_FIND_DATA fd; nCount=0; if ((hFind = ::FindFirstFile (strPath, &fd)) != INVALID_HANDLE_VALUE) ...{ TCHAR szFullPath[MAX_PATH]; ::GetFullPathName (szPath, sizeof (szFullPath) / sizeof (TCHAR), szFullPath, NULL); if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) PackFile(&file,fd.cFileName),nCount++; while (::FindNextFile (hFind, &fd)) ...{ if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) PackFile(&file,fd.cFileName),nCount++; } ::FindClose (hFind); } if(0==nCount) ...{ tmp.Format("没有找到可以打包的文件! "); ShowInfo(tmp); CFile::Remove(file.GetFileName()); } else ...{ tmp.Format("打包%s成功,共打包了%i个文件! ",PACKNAME,nCount-2); ShowInfo(tmp); } file.Close(); UpdateData(FALSE);} /**/ //解包函数/// void CPackDlg::OnUnpack() ... { // TODO: Add your control notification handler code here m_nShowInfo=PACKID; m_nShowInfo+=" "; DWORD pbuf; TCHAR strPackID[128]; TCHAR szName[4096]; CString szUpackName; CFile file(PACKNAME,CFile::modeRead); file.Read(strPackID,sizeof(PACKID)-1); strPackID[sizeof(PACKID)-1]='