Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WindowsDeleteStringBuffer function

Discards a preallocated string buffer if it was not promoted to an HSTRING.

Syntax


HRESULT WindowsDeleteStringBuffer(
  _In_  HSTRING_BUFFER bufferHandle
);

Parameters

bufferHandle [in]

Type: HSTRING_BUFFER

The buffer to discard. The WindowsDeleteStringBuffer function raises an exception if bufferHandle was not allocated by a call to the WindowsPreallocateStringBuffer function.

Return value

Type: HRESULT

This function can return one of these values.

Return codeDescription
S_OK

The buffer was discarded successfully.

E_POINTER

bufferHandle is NULL.

 

Remarks

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.

Note  Calling WindowsPromoteStringBuffer after calling WindowsDeleteStringBuffer with the same buffer handle is undefined.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Examples

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);
}



Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Header

Winstring.h

See also

WindowsPreallocateStringBuffer
WindowsPromoteStringBuffer
HSTRING
HSTRING_BUFFER

 

 

Community Additions

Show:
© 2014 Microsoft