Expand Minimize

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.

 

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.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

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

WindowsCreateString
WindowsCreateStringReference
WindowsDeleteString

 

 

Community Additions

ADD
Show:
© 2014 Microsoft