CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
IBM Rational 系统开发最佳实践工具包 WebSphere MQ 最佳实践 TOP 15
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  VCL组件开发及应用

怎么获得指定磁盘分区的大小??

楼主MarcusYin()2006-03-12 14:58:35 在 Delphi / VCL组件开发及应用 提问

另外,磁盘分区的大小会不会有变化(除了重新分区的情况)〉?? 问题点数:20、回复次数:4Top

1 楼madyak(无天)回复于 2006-03-12 15:02:05 得分 0

Returns   the   size,   in   bytes,   of   a   specified   drive.  
   
  Unit  
   
  SysUtils  
   
  Category  
   
  file   management   routines  
   
  Delphi   syntax:  
   
  function   DiskSize(Drive:   Byte):   Int64;  
   
  C++   syntax:  
   
  extern   PACKAGE   __int64   __fastcall   DiskSize(Byte   Drive);  
   
  Description  
   
  DiskSize   returns   the   size   in   bytes   of   the   specified   drive,   where   0   =   Current,   1   =   A,   2   =   B,   etc.   DiskSize   returns   -1   if   the   drive   number   is   invalid.  
   
  Note: DiskSize   is   only   available   on   Windows.  
   
  This   example   uses   a   form   with   a   label   on   it.   When   the   following   code   executes,   it   displays   a   message   in   the   label   indicating   the   number   of   KB   free,   and   what   percentage   of   the   entire   disk   space   that   represents.  
   
  var  
   
      S:   string;  
      AmtFree:   Int64;  
      Total:       Int64;  
  begin  
      AmtFree   :=   DiskFree(0);  
      Total   :=   DiskSize(0);  
      S   :=   IntToStr(AmtFree   div   Total)   +   'percent   of   the   space   on   drive   0   is   free:   '   (AmtFree   div   1024)   +   '   Kbytes   free.   ';  
      Label1.Caption   :=   S;  
  end;  
  一般不重新分区,分区大小不会改变.Top

2 楼MarcusYin()回复于 2006-03-12 15:26:52 得分 0

非常感谢:madyak(无天)    
   
  另外还有一些疑问:这个函数是否适用于所有windows   os(XP、2k);  
  scsi硬盘呢??fat32以及ntfs的都适用么??Top

3 楼madyak(无天)回复于 2006-03-12 17:20:19 得分 20

应该是没有问题的,不过我没测试过.Top

4 楼MarcusYin()回复于 2006-03-12 19:18:30 得分 0

好的,十分感谢Top

相关问题

  • 如何获取磁盘分区信息及分区空间大小和已使用大小?
  • 告急!关于磁盘逻辑分区的大小调整问题?
  • 告急!关于磁盘逻辑分区的大小调整问题?
  • 磁盘分区的问题?
  • php如何取得系统环境变量,如分区信息,磁盘内存大小等
  • .NET(C#)怎样取出网站所在的服务器磁盘分区的总大小和剩余空间大小的信息?
  • 救命呀,磁盘分区不见啦
  • 磁盘阵列分区丢失????????????????
  • 磁盘分区表没了怎么办?
  • 一硬盘分多个区,如何取得指定分区的硬盘大小和剩余空间?

关键词

  • amtfree
  • 分区
  • disksize
  • 大小
  • drive
  • total
  • label
  • free
  • bytes
  • int64

得分解答快速导航

  • 帖主:MarcusYin
  • madyak

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo