资源简介
基于zlib1.1.4的压缩类,可以压缩和解压zip文件,vc6和vs2008编译通过。
代码片段和文件信息
//_ **********************************************************
//_
//_ Name: driveinfo.cpp
//_ Purpose:
//_ Created: 15 September 1998
//_ Author: D.R.Godson
//_ Modified By:
//_
//_ Copyright (c) 1998 Brilliant Digital Entertainment Inc.
//_
//_ **********************************************************
// CDriveInfo.cpp
#include “stdafx.h“
#include “driveinfo.h“
#include
float CDriveInfo::GetFreeBytes(int nDrive)
{
CString sRoot;
unsigned long totalClusters freeClusters sectors bytes;
float fSpace;
ASSERT (nDrive > 0 && nDrive <= 26);
if (IsDriveAvailable(nDrive))
{
sRoot = GetRoot(nDrive);
::GetDiskFreeSpace(sRoot §ors &bytes &freeClusters &totalClusters);
// do maths like this to avoid truncation
// errors
fSpace = (float)sectors;
fSpace *= bytes;
fSpace *= freeClusters;
fSpace /= 1048576;
return fSpace;
}
return 0.0f;
}
CString CDriveInfo::GetVolume(int nDrive)
{
CString sVolume sRoot;
ASSERT (nDrive > 0 && nDrive <= 26);
if (IsDriveAvailable(nDrive))
{
sRoot = GetRoot(nDrive);
GetVolumeInformation(sRoot sVolume.GetBuffer(20) 20 NULL NULL NULL NULL 0);
sVolume.ReleaseBuffer();
FormatName(sVolume);
return sVolume;
}
return ““;
}
CString CDriveInfo::GetRoot(int nDrive)
{
CString sRoot;
sRoot = GetLetter(nDrive);
sRoot += _T(“:\\“);
return sRoot;
}
CString CDriveInfo::GetFullName(int nDrive)
{
CString sFullName sLetter sVolume;
ASSERT (nDrive > 0 && nDrive <= 26);
if (IsDriveAvailable(nDrive))
{
sLetter = GetLetter(nDrive);
sVolume = GetVolume(nDrive);
sFullName = sVolume + “ (“ + sLetter + “:)“;
return sFullName;
}
return ““;
}
float CDriveInfo::GetTotalBytes(int nDrive)
{
CString sRoot;
unsigned long totalClusters freeClusters sectors bytes;
float fSpace;
ASSERT (nDrive > 0 && nDrive <= 26);
if (IsDriveAvailable(nDrive))
{
sRoot = GetRoot(nDrive);
::GetDiskFreeSpace(sRoot §ors &bytes &freeClusters &totalClusters);
// do maths like this to avoid truncation
// errors
fSpace = (float)sectors;
fSpace *= bytes;
fSpace *= totalClusters;
fSpace /= 1048576;
return fSpace;
}
return 0.0f;
}
char CDriveInfo::GetLetter(int nDrive)
{
ASSERT (nDrive > 0 && nDrive <= 26);
return (char)(nDrive + ‘A‘ - 1);
}
int CDriveInfo::GetType(int nDrive)
{
CString sVolume;
ASSERT (nDrive > 0 && nDrive <= 26);
// shortcut to avoid floppy access
if (nDrive ==1 || nDrive == 2)
return DRIVE_REMOVABLE;
if (IsDriveAvailable(nDrive))
{
sVolume = GetVolume(nDrive);
FormatName(sVolume);
if (sVolume.Find(_T(“Host“)) >= 0)
return DRIVE_HOST;
else
return ::GetDriveType(GetRoot(nDrive));
}
return DRIVE_UNKNOWN;
}
void CDriveInfo::FormatName(CString& sFilename)
{
CString sTemp sChar;
int nLen nChar;
char cChar cLastC
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5148 2003-02-14 14:22 ZipTest_src\Shared\driveinfo.cpp
文件 1164 2003-02-14 14:22 ZipTest_src\Shared\driveinfo.h
文件 9964 2003-07-23 23:33 ZipTest_src\Shared\FILEMISC.CPP
文件 1744 2003-02-17 13:02 ZipTest_src\Shared\FILEMISC.H
文件 4136 2003-03-05 12:14 ZipTest_src\Shared\FolderDialog.cpp
文件 3216 2003-03-05 12:05 ZipTest_src\Shared\FolderDialog.h
文件 8528 2011-12-08 15:40 ZipTest_src\ZipTest\Debug\BuildLog.htm
文件 3597 2003-06-04 16:52 ZipTest_src\ZipTest\ReadMe.txt
文件 1078 2003-06-04 16:52 ZipTest_src\ZipTest\res\ZipTest.ico
文件 399 2003-06-04 16:52 ZipTest_src\ZipTest\res\ZipTest.rc2
文件 1603 2003-07-19 23:59 ZipTest_src\ZipTest\Resource.h
文件 209 2003-06-04 16:52 ZipTest_src\ZipTest\StdAfx.cpp
文件 999 2003-06-04 16:52 ZipTest_src\ZipTest\StdAfx.h
文件 3902 2003-06-06 23:30 ZipTest_src\ZipTest\UnzipDlg.cpp
文件 1509 2003-06-06 23:30 ZipTest_src\ZipTest\UnzipDlg.h
文件 3396 2003-07-23 22:57 ZipTest_src\ZipTest\ZipDlg.cpp
文件 1384 2003-07-19 23:58 ZipTest_src\ZipTest\ZipDlg.h
文件 1871 2003-06-04 16:52 ZipTest_src\ZipTest\ZipTest.cpp
文件 5611 2003-07-10 21:44 ZipTest_src\ZipTest\ZipTest.dsp
文件 725 2003-06-04 16:53 ZipTest_src\ZipTest\ZipTest.dsw
文件 1335 2003-06-04 16:52 ZipTest_src\ZipTest\ZipTest.h
文件 8807 2003-07-19 23:59 ZipTest_src\ZipTest\ZipTest.rc
文件 879 2011-12-08 15:40 ZipTest_src\ZipTest\ZipTest.sln
..A..H. 17920 2011-12-08 16:15 ZipTest_src\ZipTest\ZipTest.suo
文件 11235 2011-12-08 15:40 ZipTest_src\ZipTest\ZipTest.vcproj
文件 1409 2011-12-08 16:15 ZipTest_src\ZipTest\ZipTest.vcproj.aaa-PC.aaa.user
文件 1769 2003-06-06 23:28 ZipTest_src\ZipTest\ZipTestDlg.cpp
文件 1286 2003-06-06 22:30 ZipTest_src\ZipTest\ZipTestDlg.h
文件 9753 2003-07-24 20:09 ZipTest_src\ZipUnzip\Unzipper.cpp
文件 3052 2003-07-23 23:06 ZipTest_src\ZipUnzip\Unzipper.h
............此处省略19个文件信息
- 上一篇:DAC8411程序C语言版用KEIL调试通过
- 下一篇:C2B转换助手
相关资源
- diy写字机grbl v1.1源代码
- XUnZip Zip解压缩.rar
- 微机接口----HQFC集成开发环境.zip
- 基于51单片机射频RFID卡考勤上课上班
- 五子棋C++(Qt版).zip
- dsp课程设计——语音加密.zip
- [BUPT]面向对象程序设计C++ - 平时作业
- Bmp图像处理.zip
- C++实现的蓝牙应用程序框架-BlueSolei
- 扫雷辅助程序.zip
- C++ Primer中文第五版.zip
- C++ 通过FFmpeg将rtsp视频流到本地mp4文件
- hill密码的加密、解密以及破译.zip
- libcurl-7.19.3-win32-ssl-msvc.zip
- 设计并实现TINYC语言的扫描程序TINYC
- 汉字转拼音 自适应多音字处理 姓名自
- Microsoft Visual C++ 14.0.zip
- 四川大学计算机研究生复试资料整理
- c++ 数据结构 哈夫曼压缩&解压软件 控
- 单片机交通灯课程设计.zip
- VC++6.0编程实现MIF文件点集读取与凸壳
- 操作系统——5个实验.zip
- 求曼德勃罗集合C语言串行并行代码
- Fluent UDF-马世虎翻译版.zip
- DemoHttpMFC.zip
- VS2013安装.zip
- 西北工业大学软件学院计算机图形学
- php-cpp项目移值到windows的vs2017解决方案
- MISRA-C 2012.zip
- MFC程序100例.zip
评论
共有 条评论