Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getfreediskspaceex
Message
From
04/04/2002 08:59:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/04/2002 08:30:55
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00640820
Message ID:
00640834
Views:
35
>Does anyone know how to use the getfreediskspaceex api call from Foxpro?
>
>Technet has the code for VB, but it uses a struct, which I don't know how to translate.
>
>Thanks in advance
>
>Mike Williams
GetFree('c:\')

FUNCTION GetFree
LPARAMETERS tcDirectory
DECLARE short GetDiskFreeSpaceEx IN WIN32API ;
  string @ lpDirectoryName, ;
  string @ lpFreeBytesAvailable, ;
  string @ lpTotalNumberOfBytes, ;
  string @ lpTotalNumberOfFreeBytes
	
STORE SPACE(8*8) TO ;
  lpFreeBytesAvailable, ;
  lpTotalNumberOfBytes, ;
  lpTotalNumberOfFreeBytes

GetDiskFreeSpaceEx(tcDirectory, @lpFreeBytesAvailable, ;
  @lpTotalNumberOfBytes,@lpTotalNumberOfFreeBytes)
? 'FreeBytesAvailable',Str2Num(lpFreeBytesAvailable,8)  
? 'TotalNumberOfBytes',Str2Num(lpTotalNumberOfBytes,8)
? 'TotalNumberOfFreeBytes',Str2Num(lpTotalNumberOfFreeBytes,8)

FUNCTION Str2num
LPARAMETERS tcStr,tnLen
local lnRetVal
lnRetVal = 0
FOR ix=1 TO tnLen
	lnRetVal = lnRetVal + ASC(SUBSTR(tcStr,ix))*(256^(ix-1))
endfor
RETURN TRANSFORM(lnRetVal,'999,999,999,999,999')
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform