>Hi,
>
>I am using the GetDiskFreeSpaceEx API to get the Current Drive's Disk space. I want to display the total space and free space available on the disk.
>The GetDiskFreeSpaceEx return the value in bytes.
>
>Is there any wan I can convert the Bytes to MB or GB.
>
>Any Suggestions.
>Regards,
>JD
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/string/strformatbytesizea.aspStrFormatByteSizeA Function
"Converts a numeric value into a string that represents the number expressed as a size value in bytes, kilobytes, megabytes, or gigabytes, depending on the size."
LPARAMETERS qdw
LOCAL pszBuf
m.pszBuf = SPACE(254)
DECLARE INTEGER StrFormatByteSizeA IN shlwapi;
INTEGER qdw,;
STRING @ pszBuf,;
INTEGER uiBufSize
StrFormatByteSizeA(m.qdw, @m.pszBuf, Len(m.pszBuf))
m.pszBuf = ALLTRIM(m.pszBuf)
m.pszBuf = Left(m.pszBuf,Len(m.pszBuf)-1)
RETURN ALLTRIM(m.pszBuf)