|
 |
|
|
|
| Mailing-Liste |
|
|
 |
| Inhalt |
|
|
|
|
|
Determine free disk space
|
13.09.2001
|
MAPINFO-L
Here is some code that will return (I think it does) the total number of
free bytes on a drive. You need to call the ...Ex function and do some
juggling to recompose the value (it might be > than integer maximum). I
would love to get some improvements on this if it is necessary.
One interesting question: the returned value is quite different from what
"properties" of C:\ (windows explorer) gives.
'===============================
Type ULARGE_INTEGER
LowPart As integer
HighPart As integer
End Type
Declare Function GetDiskFreeSpaceEx Lib "kernel32.dll" Alias
"GetDiskFreeSpaceExA"
(ByVal lpDirectoryName As String, lpFreeBytesAvailableToCaller As
ULARGE_INTEGER ,
lpTotalNumberOfBytes As ULARGE_INTEGER,
lpTotalNumberOfFreeBytes As ULARGE_INTEGER ) As integer
declare sub main
dim lpDirectoryName as string
dim lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes,
lpTotalNumberOfFreeBytes As ULARGE_INTEGER
dim return as string
sub main
lpDirectoryName="c:\data\"
if GetDiskFreeSpaceEx(lpDirectoryName,lpFreeBytesAvailableToCaller,
lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes)>0 then
return=str$(-lpTotalNumberOfFreeBytes.lowpart)
if (lpTotalNumberOfFreeBytes.highpart)>0 then
return=return+str$(lpTotalNumberOfFreeBytes.highpart)
end if
note "Free bytes on : "+lpDirectoryName+chr$(10)+chr$(10)+return
else
note "problem with call to GetDiskFreeSpaceEx"
end if
end sub
|
|
|
Quelle: MAPINFO-L
, Jacques Paris
|
|
|
 |
|
|