WindowsDeleteStringBuffer function (winstring.h)
Discards a preallocated string buffer if it was not promoted to an HSTRING.
HRESULT WindowsDeleteStringBuffer(
HSTRING_BUFFER bufferHandle
);
bufferHandle
Type: [in] HSTRING_BUFFER
The buffer to discard. The WindowsDeleteStringBuffer function raises an exception if bufferHandle was not allocated by a call to the WindowsPreallocateStringBuffer function.
Type: HRESULT
This function can return one of these values.
Return code | Description |
---|---|
|
The buffer was discarded successfully. |
|
bufferHandle is NULL. |
Use the WindowsDeleteStringBuffer function to discard a string buffer that was created by the WindowsPreallocateStringBuffer function but has not been promoted to an HSTRING by the WindowsPromoteStringBuffer function.
The following code example demonstrates how to use the WindowsDeleteStringBuffer function.
int main()
{
HSTRING_BUFFER hStringBuffer = NULL;
PWSTR strBuffer = NULL;
HRESULT hr = WindowsPreallocateStringBuffer(10, &strBuffer, &hStringBuffer);
// You hit a case in which you need to discard the buffer.
WindowsStringDeleteBuffer(hStringBuffer);
}
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2012 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | winstring.h |
Library | RuntimeObject.lib |
DLL | ComBase.dll |