This topic has not yet been rated - Rate this topic

StrFormatByteSizeEx function

Applies to: desktop apps only

Converts a numeric value into a string that represents the number in bytes, kilobytes, megabytes, or gigabytes, depending on the size. Extends StrFormatByteSizeW by offering the option to round to the nearest displayed digit or to discard undisplayed digits.

Syntax

HRESULT StrFormatByteSizeEx(
  __in   ULONGLONG ull,
  __in   SFBS_FLAGS flags,
  __out  LPWSTR pszBuf,
  __in   UINT cchBuf
);

Parameters

ull [in]

Type: ULONGLONG

The numeric value to be converted.

flags [in]

Type: SFBS_FLAGS

A member of the SFBS_FLAGS enumeration that specifies whether to round or truncate undisplayed digits.

pszBuf [out]

Type: LPWSTR

A pointer to a buffer that receives the converted string.

cchBuf [in]

Type: UINT

The size of pszBuf, in characters.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Examples


2147483647 -> "2.00 GB" (with rounding)
2147483647 -> "1.99 GB" (with truncation)

Requirements

Minimum supported client

Windows Vista with SP1

Minimum supported server

Windows Server 2008

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 6.0 or later)

See also

StrFormatByteSize64
StrFormatByteSizeA
StrFormatByteSizeW

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ