不知到用哪个函数可以返回磁盘的大小,比如C盘,我找了一天也没找到,哪位大侠可以告诉我????

解决方案 »

  1.   

    晕,没有函数的。我以前写过一个程序的现在都OVER了:(伤心,泡不到分了
      

  2.   

    'In general section
    Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As LongPrivate Sub Form_Load()
        'KPD-Team 1998
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]    Dim Sectors As Long, Bytes As Long, FreeC As Long, TotalC As Long, Total As Long, Freeb As Long
        'Retrieve information about the C:    GetDiskFreeSpace "C:\", Sectors, Bytes, FreeC, TotalC
        'Set graphic mode to persistent
        Me.AutoRedraw = True
        'Print the information to the form
        Me.Print " Path: C:\"
        Me.Print " Sectors per Cluster:" + Str$(Sector)
        Me.Print " Bytes per sector:" + Str$(Bytes)
        Me.Print " Number Of Free Clusters:" + Str$(FreeC)
        Me.Print " Total Number Of Clusters:" + Str$(TotalC)
        Total = rTotalc& * rSector& * rBytes&
        Me.Print " Total number of bytes in path:" + Str$(Total)
        Freeb = rFreec& * rSector& * rBytes&
        Me.Print " Free bytes:" + Str$(Freeb)
    End Sub
      

  3.   

    http://www.vczx.com/article/show.php?id=544
      

  4.   

    够快,刚想打个GetDiskSpace()出来,就回了两句QQ就被你们把分抢走了!
      

  5.   

    用FSO 很容易实现:
    Option Explicit
    '需要引用  Microsoft Scripting RuntimePrivate Sub Command1_Click()
        Dim mDrive As Drive
        Dim FSO As New FileSystemObject
        Set mDrive = FSO.GetDrive("c:\")
        MsgBox mDrive.TotalSize
        Set FSO = Nothing
        Set mDrive = Nothing
    End Sub
      

  6.   

    还可以用WMI实现,不过用在win98下有些麻烦