0 out of 1 rated this helpful - Rate this topic

StrFormatByteSizeW function

Applies to: desktop apps only

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. Differs from StrFormatByteSizeA in one parameter type.

Syntax

PWSTR StrFormatByteSizeW(
  LONGLONG qdw,
  __out  PWSTR pszBuf,
  UINT cchBuf
);

Parameters

qdw

Type: LONGLONG

The numeric value to be converted.

pszBuf [out]

Type: PWSTR

A pointer to a buffer that, when this function returns successfully, receives the converted number.

cchBuf

Type: UINT

The size of pszBuf, in characters.

Return value

Type: PWSTR

Returns the address of the converted string, or NULL if the conversion fails.

Remarks

The first parameter of this function has a different type for the ANSI and Unicode versions. If your numeric value is a DWORD, you can use StrFormatByteSize with text macros for both cases. The compiler will cast the numerical value to a LONGLONG for the Unicode case. If your numerical value is a LONGLONG, you should use StrFormatByteSizeW explicitly.

Examples


       532 -> 532 bytes
      1340 -> 1.3KB
     23506 -> 23.5KB
   2400016 -> 2.4MB
2400000000 -> 2.4GB

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP

Minimum supported server

Windows 2000 Server

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 4.71 or later)

Unicode and ANSI names

StrFormatByteSizeW (Unicode)

See also

StrFormatByteSize64
StrFormatByteSizeEx
StrFormatByteSizeA

 

 

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