如何利用GetDiskFreeSpaceEX取得硬盘信息(30分)

  • 主题发起人 主题发起人 abigfish
  • 开始时间 开始时间
A

abigfish

Unregistered / Unconfirmed
GUEST, unregistred user!
请哪位大侠给段代码<br>
 
procedure TForm1.Button1Click(Sender: TObject);<br>var I:Integer;<br>&nbsp; &nbsp; TotalDiskFree:Integer;<br>&nbsp; &nbsp; FreeByte,TotalByte: Int64;<br>begin<br>&nbsp; TotalDiskFree:=0;<br>&nbsp; for I:=Ord('C') To Ord('Z') do<br>&nbsp; begin<br>&nbsp; &nbsp; if GetDrivetype(PChar(Chr(I)+':/'))=DRIVE_FIXED then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; GetDiskFreeSpaceEx(PChar(Chr(I)+':/'),FreeByte, TotalByte,nil);<br>&nbsp; &nbsp; &nbsp; TotalDiskFree:=TotalDiskFree+(FreeByte Div (1024*1024));<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br>&nbsp; ShowMessage(IntToStr(TotalDiskFree));<br>end;
 
C:/容量771<br>D:/容量6223<br>E:/容量6554<br><br>这个信息好像不准确?
 
接受答案了.
 
好象不能超过2G
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部