WindowsDuplicateString function (winstring.h)
Creates a copy of the specified string.
Syntax
HRESULT WindowsDuplicateString(
HSTRING string,
HSTRING *newString
);
Parameters
string
Type: [in] HSTRING
The string to be copied.
newString
Type: [out] HSTRING*
A copy of string.
Return value
Type: HRESULT
This function can return one of these values.
Return code | Description |
---|---|
|
The HSTRING was copied successfully. |
|
newString is NULL. |
|
Failed to allocate the new HSTRING. |
Remarks
Use the WindowsDuplicateString function to copy an HSTRING. If string was created by calling the WindowsCreateString function, the reference count of the backing buffer is incremented. If string was created by calling the WindowsCreateStringReference function, the Windows Runtime copies its source string to a new buffer and starts a reference count, which means that newString is not a fast-pass string.
Each call to the WindowsDuplicateString function must be matched with a corresponding call to WindowsDeleteString.
Requirements
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 |