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.
Syntax
LPWSTR WINAPI ShortSizeFormatExportW (
DWORD value,
LPWSTR pwszBuf
)
Parameters
- value
- The numeric value to be converted.
- pwszBuf
- A pointer to the converted string. The length of the string buffer is assumed to be 36863 (0x8fff) characters by the function.
Return Value
The address of the converted string, or NULL if the conversion fails.
Remarks
It is a basic wrapper around StrFormatByteSizeW. Even though the function assumes a buffer length of 0x8fff characters, it is practically impossible for the converted string to be that length.
This function is also known as _ShortSizeFormatExportW@8. It was called _ShortSizeFormatW@8 on Windows 2000 and NT4.
Example
#include <windows.h> #include <iostream> typedef LPWSTR (CALLBACK*pfnShortSizeFormatExportW)(DWORD, LPWSTR); int __cdecl wmain(int argc, wchar_t** argv) { HMODULE hUser = LoadLibrary(L"shell32.dll"); pfnShortSizeFormatExportW shortSizeFormatExportW = (pfnShortSizeFormatExportW)GetProcAddress(hUser, (LPSTR)204); WCHAR buf[90] = {0}; std::wcout << L"ShortSizeFormatExportW(90) = " << shortSizeFormatExportW(90, buf) << L'\n'; std::wcout << L"ShortSizeFormatExportW(900) = " << shortSizeFormatExportW(900, buf) << L'\n'; std::wcout << L"ShortSizeFormatExportW(9000) = " << shortSizeFormatExportW(9000, buf) << L'\n'; std::wcout << L"ShortSizeFormatExportW(90000) = " << shortSizeFormatExportW(90000, buf) << L'\n'; std::wcout << L"ShortSizeFormatExportW(900000) = " << shortSizeFormatExportW(900000, buf) << L'\n'; std::wcout << L"ShortSizeFormatExportW(9000000) = " << shortSizeFormatExportW(9000000, buf) << L'\n'; std::wcout << L"ShortSizeFormatExportW(90000000) = " << shortSizeFormatExportW(90000000, buf) << L'\n'; FreeLibrary(hUser); return 0; }
OUTPUT ------ ShortSizeFormatExportW(90) = 90 bytes ShortSizeFormatExportW(900) = 900 bytes ShortSizeFormatExportW(9000) = 8.78 KB ShortSizeFormatExportW(90000) = 87.8 KB ShortSizeFormatExportW(900000) = 878 KB ShortSizeFormatExportW(9000000) = 8.58 MB ShortSizeFormatExportW(90000000) = 85.8 MB