![]() |
(SST) ShlWAPI.pas Version 1.08 |
---|---|
Developer Reference |
Formats a signed, 64-bit integer value as a string that expresses the value's size in number of KBytes (1024 bytes). |
Scope |
---|
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas). |
Parameters | |
---|---|
qdw [in] | The signed 64-bit integer to format. |
pszBuf [out] | A pointer to the buffer into which the zero-terminated, output string should be written. |
cchBuf [in] | The size of the buffer pointed to by pszBuf, in number of ANSI or Unicode characters, including the terminating NULL character. |
Return Values |
---|
If the function was able to write an output text to the buffer, it returns a pointer to the formatted string. If the function fails, for example, becahse of an inadequate buffer, it returns NIL. |
Example |
---|
PROCEDURE TForm4.TestShlWAPIStrFormatKBSize(Sender : TObject); VAR filehandle : HFILE; VAR sizetoconvert : LARGE_INTEGER; VAR disksize : LARGE_INTEGER; VAR totalnumfree : LARGE_INTEGER; VAR sizestrbuf : ARRAY[0 .. 127] OF CHAR; VAR bufsize : UINT; VAR apiretpointer : PChar; VAR newinfoline : STRING; BEGIN filehandle := 0; FillChar(sizetoconvert, SizeOf(sizetoconvert), #0); FillChar(disksize, SizeOf(disksize), #0); FillChar(totalnumfree, SizeOf(totalnumfree), #0); FillChar(sizestrbuf, Length(sizestrbuf), #0); bufsize := 0; apiretpointer := NIL; newinfoline := ''; filehandle := CreateFile('C:\Windows\System32\ShlWAPI.dll', GENERIC_READ, FILE_SHARE_READ OR FILE_SHARE_WRITE, NIL, OPEN_EXISTING, 0, 0); sizetoconvert.LowPart := GetFileSize(filehandle, @sizetoconvert.HighPart); newinfoline := 'StrFormatKBSize called with ' + IntToStr(Int64(sizetoconvert)); Memo1.Lines.Add(newinfoline); bufsize := Length(sizestrbuf); apiretpointer := StrFormatKBSize(LONGLONG(sizetoconvert), sizestrbuf, bufsize); newinfoline := apiretpointer; Memo1.Lines.Add(newinfoline); CloseHandle(filehandle); GetDiskFreeSpaceEx('C:\', Int64(sizetoconvert), Int64(disksize), @totalnumfree); newinfoline := 'StrFormatKBSize called with ' + IntToStr(Int64(sizetoconvert)); Memo1.Lines.Add(newinfoline); bufsize := Length(sizestrbuf); apiretpointer := StrFormatKBSize(LONGLONG(sizetoconvert), sizestrbuf, bufsize); newinfoline := apiretpointer; Memo1.Lines.Add(newinfoline); Memo1.Lines.Add(''); END; |
The above example ought to produce an output similar to that below. |
StrFormatKBSize called with 351744 344 KB StrFormatKBSize called with 3004235776 2,933,824 KB |
Requirements | |
---|---|
Unit: | Declared and imported in (SST)ShlWAPI.pas |
Library: | (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj |
Unicode: | Implemented as ANSI (StrFormatKBSize and StrFormatKBSizeA) and Unicode (StrFormatKBSizeW) functions. |
Min. ShlWAPI.dll version according to MS SDK doc.: | 5.0 |
Min. ShlWAPI.dll version based on SST research: | 5.0 |
Min. OS version(s) according to Microsoft SDK doc.: | Windows 2000, Windows NT 4.0 with Internet Explorer 5, Windows 98, Windows 95 with Internet Explorer 5 |
Min. OS version(s) according to SST research.: | Windows NT 4.0 ... with IE 5, Windows 98, Windows 95 with IE 5, Windows 2000 and later |
See Also |
---|
StrFormatByteSizeA, StrFormatByteSizeW, StrFormatByteSize64A. |
Windows APIs: StrFormatByteSize, StrFormatByteSize64A, StrFormatByteSizeEx, StrFormatKBSize. |
Document/Contents version 1.00 Page/URI last updated on May 04, 2022 |
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017 |
Suggestions and comments mail to: webmaster@stoelzelsoftwaretech.com |