请问 VB.NET 如何得到C盘剩余空间和C盘总空间

xwqjamky 2008-05-08 04:21:14
请问 VB.NET 如何得到C盘剩余空间 和C盘总空间
...全文
143 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
LYDF4151 2008-05-09
  • 打赏
  • 举报
回复
Declare Function getdiskfreespace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal Path As String, ByRef a As Long, ByRef b As Long, ByRef c As Long, ByRef d As Long) As Long

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Try
Dim SectorOfCluster, ByteOfSector, freeCluster, TotalCluster As Long
Dim result As Long

result = getdiskfreespace("f:\", SectorOfCluster, ByteOfSector, freeCluster, TotalCluster)


TextBox6.Text = String.Concat(((freeCluster * SectorOfCluster * ByteOfSector) / (1024 ^ 3)).ToString("##0.00"), "G")


TextBox7.Text = String.Concat(((TotalCluster * SectorOfCluster * ByteOfSector) / (1024 ^ 3)).ToString("##0.00"), "G")

Catch ex As Exception
MsgBox(ex.ToString)

End Try
End Sub
llsus 2008-05-08
  • 打赏
  • 举报
回复
        Dim D As New System.IO.DriveInfo("c:")
MsgBox(D.TotalFreeSpace)
MsgBox(D.TotalSize)

16,718

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧