Hi,
It's good that you share your finding. You could have found this, too, and also asking even when you find something can yield some more ideas and resources you dodn't know.
VFP for example also has a DISKSPACE() function.
Code:
? TRANSFORM(Diskspace("C",2),'999,999,999,999,999'+' Bytes' )
gives the same number as the FSO drive object for me, but the reference says it's Bytes. And that works out.
Serialnumber isn't covered by native VFP language, true, but you're actually not the first to post something like that.
thread184-886892
thread184-951493
thread184-137380
thread184-756938
thread184-289352
...
In general, if you need something OS and Hardware related, VFP surely isn't #1 tool, but WNI scripts can easily be adapted for VFP. Once you have the WMIService Object (missing from Mike's code):
Code:
loWMIService = GETOBJECT("winmgmts:\\.")
or more specific like GetObject("winmgmts:\\.\root\directory\LDAP") for AD access
And others. Well, the world of WMI.
Today I'd like to do more with Powershell. Doug Henning has written about that and the last few pages also show how to run this from VFP with the help of the wwDotNetBridge:
Otherwise, a classic resource of all the functionalities the OS offers:
And one specifically sometimes problematic topic with API calls asking for structs can be covered by struct.zip by Chris Wollenhaupt, see
Anyway, some things are actually also part of VFP itself. And I wouldn't even look for how to get free Diskspace of the current user in the current thread by helper COM objects or API, when there is a native VFP function for it-
By the way, any programming language is heavily stealing from the API or nowadays the .net framework when it comes to commands related to os or hardware and that's also a reason some things like low level file functions look the same in so many languages. Once you know that DECLARE almost becomes a language extension command.
Bye, Olaf.
Olaf Doschke Software Engineering