Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetDiskFreeSpace and the like
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00620479
Message ID:
00620481
Views:
16
You've to specify in DECLARE that those parameter're passed by reference, properly initialize them and pass by reference to the function.
DECLARE LONG GetDiskFreeSpace IN kernel32 ;
	STRING, LONG @, LONG @, LONG @, LONG @
LOCAL ret, strDrive, lngSectors, lngBytes, lngFreec, lngTotalc
STORE 0 TO lngSectors, lngBytes, lngFreec, lngTotalc
ret = GetDiskFreeSpace(strDrive, @lngSectors, @lngBytes, @lngFreec, @lngTotalc)
? ret, lngSectors, lngBytes, lngFreec, lngTotalc
The function GetDiskFreeSpace has a bug. See faq #7847 for to how get correct info.

>Hi All!
>How come when I use this API call, the last 4 parameters aren't being returned in VFP? I've tried it in VB and it works fine (giving me the sectors per cluster, bytes per cluster, free clusters and total number of clusters). I declared it as such:
>
>DECLARE LONG GetDiskFreeSpace IN kernel32.dll STRING, LONG, LONG, LONG, LONG
>
>and called it like so:
>
>LOCAL ret, strDrive, lngSectors, lngBytes, lngFreec, lngTotalc
>ret = GetDiskFreeSpace(strDrive, lngSectors, lngBytes, lngFreec, lngTotalc)
>
>ret evaluates to a non-zero which means the call was successful, but how come I don't get any return values that the function should return?
>
>In VFP, how do you go about declaring an API call, and calling it? Especially those API calls that contain more than one parameter and returns more than one variable? Thanks.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform