资源简介
基于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转换助手
相关资源
- 课程设计课程表.zip
- 数据结构课程设计散列表的设计与实
- zw_基于Ribbon界面的图书管理系统—w
- zw_记事本源码c++.zip
- zw_AES加密算法c语言实现代码.zip
- c语言课程设计电影院管理系统.zip
- PlugY-master
- php-5.2.17-nts-Win32-VC6-x86.zip
- 项目16 基于单片机LCD数字测速仪的设
- c++视频教程opencv视频图像处理机器视
- C和C++高级课设源码和资源.zip
- ioncube_loaders_win_nonts_vc6_x86.zip
- SLAM视觉里程计高端代码.zip
- 浦发银行机试代码C语言.zip
- grpc-x86_64-1.27.2-2-any.zip
- zip源码精简版
- zip文件压缩解压源码 c++
- 华为编程规范.zip
- C语言伪造TCP、UDP数据包.zip
- 未来教育c语言破解补丁.zip
- Speech-Recognition-说话人语音识别MATLAB代
- 车牌识别算法c++识别率99.7%.zip
- C++ zip解压缩压缩
- RSA算法C语言实现.zip
- MFC工程 zip 压缩和解压 (支持文件夹
- 中科大23系微电子复试资料.zip
- GNSS单频软件接收机应用与编程.zip
- QGIS-OSGeo4W-3.12.1-1-Setup-x86_64国内地址
- BCH_SOURCE(63_56).zip
- asn1c ASN.1 编译器.zip
评论
共有 条评论