|
-
Aug 9th, 2000, 10:01 AM
#1
Thread Starter
Evil Genius
Probably an easy one, but using the getdiskfreespace or getdiskfreespaceex functions returns a value of "4082760192".
How do all you guys (and girls) show this as "4.1GB" for example in your apps?
Thank you!
Alex Read
-
Aug 9th, 2000, 11:09 AM
#2
Good Ol' Platypus
It returns the number of BYTES on the HD, not MB or GB. To convert, use this:
Code:
Function FreeMB() As long
FreeMB = GetDiskFreeSpace("C") / 1024
End Function
I know that's not how to use getdiskfreespace, but you get the idea.
FreeMB = GetDiskFreeSpace / 1024
FreeGB = FreeMB /1000
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 11:09 AM
#3
Hyperactive Member
BYTE ME!
The value is the number of bytes
val/1024 = kb
val/1024^2=mb
val/1024^3=gb etc
even better you can format the final value
Code:
val=format(val,"##,##0.00")
gives xx,xxx.xx!
-
Aug 10th, 2000, 02:49 AM
#4
Thread Starter
Evil Genius
Thank you everyone!
Appriciate you writing back. Just one thing, Gravyboy "Byte Me" is this the worst pun we have seen on this site?
Thank you once again!
-
Aug 10th, 2000, 03:12 AM
#5
Hyperactive Member
Pun Frenzy!
Alex,
It may well be! GetFreeDiskSpaceEx is the one to use as it has additional abilities, can't remember what they are but they are there!
-
Aug 10th, 2000, 05:35 AM
#6
Thread Starter
Evil Genius
leads me to another question
I noticed quite a few have the ex on, not just withgetdiskfreespace. Why? they do the same function, call on the same dll's. What's the advantage?
Thank you,
confused.
-
Aug 10th, 2000, 05:52 AM
#7
Hyperactive Member
MSDN
Windows 95 OSR2 and later:
The GetDiskFreeSpaceEx function is available on Windows 95 systems beginning with OEM Service Release 2 (OSR2). The GetDiskFreeSpaceEx function returns correct values for all volumes, including those that are greater than 2 gigabytes.
That's from MSDN April 99.
-
Aug 10th, 2000, 05:58 AM
#8
Thread Starter
Evil Genius
ohhhhhh,
Thank you once again. So the main reason is the operability on a wider range of operating systems.
You learn something new every day!
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|