MilesAhead Posted May 26, 2015 Posted May 26, 2015 There is the API _WinAPI_GetDiskFreeSpaceEx() to get the free space remaining on a volume. But I have not found any API to get either the capacity of a volume or the used space on a volume. It seems like it should be a no brainer. But I suspect it will be one of those WMI deals for some unknown reason. Anyone have a non WMI solution? My Freeware Page
UEZ Posted May 26, 2015 Posted May 26, 2015 (edited) Try this:#include <WinAPIMisc.au3> ConsoleWrite(_WinAPI_GetDiskFreeSpace("C") & @CRLF) Func _WinAPI_GetDiskFreeSpace($sDrive, $bAutoConvert = False) Local $aRes = DllCall("kernel32.dll", "uint", "GetDiskFreeSpace", "str", StringLeft($sDrive, 1) & ":\", "dword*", NULL, "dword*", NULL, "dword*", NULL, "dword*", NULL) If @error Or Not $aRes[0] Then Return SetError(1, 0, 0) Return $bAutoConvert ? _WinAPI_StrFormatByteSize($aRes[2] * $aRes[4] * $aRes[3]) : $aRes[2] * $aRes[4] * $aRes[3] EndFunc Or #include <WinAPIFiles.au3> _WinAPI_GetDiskFreeSpaceEx ( $sDrive ) Edited May 26, 2015 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
spudw2k Posted May 26, 2015 Posted May 26, 2015 Do DriveSpaceTotal() and DriveSpaceFree() not suit your purposes? Reveal hidden contents Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
UEZ Posted May 26, 2015 Posted May 26, 2015 Too simple. argumentum 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
MilesAhead Posted May 26, 2015 Author Posted May 26, 2015 On 5/26/2015 at 8:55 PM, spudw2k said: Do DriveSpaceTotal() and DriveSpaceFree() not suit your purposes?Didn't know they were there. Thanks. On 5/26/2015 at 9:04 PM, UEZ said: Too simple. I know. It is cheating when it's that easy. My Freeware Page
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now