怎样获得指定区的磁盘总大小和可用空间大小?
怎样获得指定区的磁盘总大小和可用空间大小? 问题点数:20、回复次数:5Top
1 楼dyugao(晕头转向)回复于 2004-12-03 09:57:47 得分 4
GetDiskFreeSpaceExTop
2 楼danyueer(淡月儿:从此以后,各人得各人的眼泪罢了)回复于 2004-12-03 10:13:00 得分 4
GetDiskFreeSpaceEx
The GetDiskFreeSpaceEx function retrieves information about the amount of space available on a disk volume: the total amount of space, the total amount of free space, and the total amount of free space available to the user associated with the calling thread.
BOOL GetDiskFreeSpaceEx(
LPCTSTR lpDirectoryName, // directory name
PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller
PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk
PULARGE_INTEGER lpTotalNumberOfFreeBytes // free bytes on disk
);
From MSDNTop
3 楼chuanke((C ) 2005【空间代数】. All rights reserved .)回复于 2004-12-03 11:57:05 得分 4
CString strDRV = "c:\\";// ( const char * )m_cbbDRV.GetItemDataPtr( m_cbbDRV.GetCurSel());
ULARGE_INTEGER FreeAv, TotalBytes, FreeBytes;
CString strTmp = "",strTmp2 = "";
if (GetDiskFreeSpaceEx(strDRV,&FreeAv,&TotalBytes,&FreeBytes))
{
strTmp.Format("HDDTotal VOL:%uM", TotalBytes.QuadPart/1024/1024);
strTmp2.Format("Free VOL:%uM", FreeBytes.QuadPart/1024/1024);
}
Top
4 楼russule(雨田)回复于 2004-12-03 12:09:40 得分 4
ShowText.Format("磁盘空余:%dM",m_diskMan.GetDiskFree(g_FilePath.Left(3)));
m_StaticDisk.SetWindowText(ShowText);Top
5 楼oyljerry(【勇敢的心】→ ㊣提拉米苏√㊣)回复于 2004-12-03 12:10:27 得分 4
GetDiskFreeSpaceEx("E:",&FreeAv,&TotalBytes,&FreeBytesTop




