//获取文件的大小,并以KB 或 MB 来表示 CString GetFileSize(LONG size) { CString _size; //判断大小有没有超过1 if (size<(1024*1024)) { _size.Format("%.2lfKB",size/1024.0); }else if(1024*1024*1024) { _size.Format("%.2lfMB",(size/1024.0)/1024.0); }else { _size.Format("%.2lfGB",(size/1024.0/1024.0)/1024.0); } return _size; } //获取下载速度的字符串 CString GetFileTranSpeed(DWORD size,DWORD time) { CString _speed; //判断时间是否为0 if (time>0){ if (size/1024*1000.0/time<1024) { _speed.Format("%.2lfKB/s",size/1024*1000.0/time); }else { _speed.Format("%.2lfMB/s",(size/1024)*1000.0/time); } }else { return _speed = "0KB/s"; } return _speed; } //获取时间的字符串 CString GetTimeFormatStr(LONG time) { CString _time; int hh = time/3600; int mm = (time-hh*3600)/60; int ss = time%60; _time.Format("%d%d:%d%d:%d%d",hh/10,hh%10,mm/10,mm%10,ss/10,ss%10); return _time; }