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.

WindowsDuplicateString function

Creates a copy of the specified string.

Syntax


HRESULT WINAPI WindowsDuplicateString(
  _In_  HSTRING string,
  _Out_ HSTRING *newString
);

Parameters

string [in]

Type: HSTRING

The string to be copied.

newString [out]

Type: HSTRING*

A copy of string.

Return value

Type: HRESULT

This function can return one of these values.

Return codeDescription
S_OK

The HSTRING was copied successfully.

E_INVALIDARG

newString is NULL.

E_OUTOFMEMORY

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

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8

Header

Winstring.h

See also

WindowsCreateString
WindowsCreateStringReference
WindowsDeleteString

 

 

Show: