Antoine.st 64bit Numeric Value

64 bit の数値

GetDiskFreeSpaceEx() は、ULARGE_INTEGER (64ビット整数) のポインタを引数として受け取ります。ポインタなので ByRef でやり取りすれば OK ですね。


  Declare Ansi Function GetDiskFreeSpaceEx Lib "Kernel32.dll" _
      Alias "GetDiskFreeSpaceExA" _
      (ByVal lpDirectoryName As String, _
       ByRef lpFreeBytesAvailable As Long, _
       ByRef lpTotalNumberOfBytes As Long, _
       ByRef lpTotalNumberOfFreeBytes As Long) As Boolean

  Private Sub Button1_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs _
  ) Handles Button1.Click

      Dim freeBytes As Long
      Dim totalBytes As Long
      Dim totalFree As Long
      Dim result As Boolean

      result = _
          GetDiskFreeSpaceEx( _
              vbNullString, _
              freeBytes, _
              totalBytes, _
              totalFree)

  End Sub