30
Mar
10

Bagaimana Memperoleh Nilai “Free Space” Dari Sebuah Disk?

Meskipun sebetulnya tidak cukup sulit untuk menampilkan properti dari sebuah objek (file, folder, dll), tapi terkadang kita hanya butuh memperoleh nilai “free space” yang nantinya akan diolah lebih lanjut.

API tetap menjadi andalan utama untuk mengakses sistem, berikut source codenya:

Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long

    Public Function GetFreeSpace(ByVal Drive As String) As Currency

        Dim BytesFreeToCalller As Currency
        Dim TotalBytes As Currency
        Dim TotalFreeBytes As Currency

        If Right(Drive, 1) <> "\" Then Drive = Drive & "\"
        GetDiskFreeSpaceEx Drive, BytesFreeToCalller, TotalBytes, TotalFreeBytes

        GetFreeSpace = TotalFreeBytes * 10000

    End Function

Image source: tivocommunity.com


0 Responses to “Bagaimana Memperoleh Nilai “Free Space” Dari Sebuah Disk?”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Quotes of The Week

20 April 2010 - 26 April 2010

Imam Ahmad bin Hambal ditanya, "Kapan seorang hamba bisa istirahat?" Beliau menjawab, "Ketika kakinya menginjak syurga."

- Imam Ahmad bin Hambal

Blog Stats

  • 4,164 hits

Featured Image


Mount Fuji in Japan | kiraku.tv
Indahnya Gunung Fuji melatarbelakangi bunga sakura yang sedang bersemi. (Mar 23, 10)

Archives


%d bloggers like this: