下载吧压缩工具(360超级注释压缩)
void CAutoZipDlg::OnButton6() { // TODO: Add your control notification handler code here int iArg; //命令行参数个数 CString psz; //文件表 CString relative; //360zip相对路径 CString relative_zip; //存储zip的相对目录 CString exec_str; //命令行要执行的命令字符串 //要压缩的文件表 for( iArg = 1; iArg < __argc; iArg++ ) { psz = psz + "\"" + __argv[iArg] + "\"" + " "; // 360SZip.exe -s"\monitor_XiaZaiBa.zip" -m"model.zip" -z"psz" } //MessageBox(psz); //显示文件表 //查找最后一个"\",获得360zip相对目录 relative = __argv[0]; relative = relative.Left(relative.ReverseFind('\\')); MessageBox(relative); //显示360zip相对目录 //查找最后一个"\",获得存储zip相对目录 relative_zip = __argv[1]; //判断路径是否为目录 //#include <sys\stat.h> //#ifndef S_ISDIR //#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) //#endif struct stat buf; //定义stat结构体变量 memset(&buf, 0, sizeof(struct stat)); //清零内存 if(stat(relative, &buf) != 0) { MessageBox("Error!!!Debug 1"); //获取信息失败 } //CString aa, bb, cc; //aa.Format("aa=%d", buf.st_mode); //bb.Format("bb=%d", S_IFMT); //cc.Format("cc=%d", (buf.st_mode) & S_IFMT); //MessageBox(aa + "\n\r" + bb + "\n\r" + cc); //if(!S_ISDIR(buf.st_mode)) //st_mode最低的9位(0-8)是权限,9-11是id,12-15是类型。 if(!((buf.st_mode) & S_IFMT) == S_IFDIR) { relative_zip = relative_zip.Left(relative_zip.ReverseFind('.')); //如果是文件则获取文件名去其后缀 } MessageBox(relative_zip); //显示存储zip相对目录 exec_str ="\"" + relative + "\\" + "360SZip.exe" + "\"" + " "; exec_str = exec_str + "-s\"" + relative_zip + "_XiaZaiBa.zip" + "\"" + " "; exec_str = exec_str + "-m\"" + relative + "\\" + "model.zip" + "\"" + " "; exec_str = exec_str + "-z" + psz; exec_str = exec_str + "\"" + relative + "\\" + "*.htm" + "\""; exec_str = exec_str + "& pause..."; //测试用让DOS窗口暂停 MessageBox(exec_str); //显示命令字符串 system("\"" + exec_str + "\""); //执行命令 //CString str1, test; //str1 = "\"" + relative + "\\" + "360SZip.exe" + "\"" + " " ; //str1 =str1 + "-s\"monitor_XiaZaiBa.zip\" -m\"model.zip\" -z"; //test = str1 + psz + "*.htm" + "& pause"; //test = "\"E:\\mysvn\\vc++\\AutoZip\\Debug\\te (askdf)st\""; //test = test + "& pause"; //system("\"" + test + "\""); //system(test); //system(test); //MessageBox(test); }
学习笔记转摘于:
丝酷网 http://www.pythonschool.com/