Skip to content

Latest commit

 

History

History
128 lines (104 loc) · 3.41 KB

nf-winstring-windowsduplicatestring.md

File metadata and controls

128 lines (104 loc) · 3.41 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winstring.WindowsDuplicateString
WindowsDuplicateString function (winstring.h)
Creates a copy of the specified string.
WindowsDuplicateString
WindowsDuplicateString function [Windows Runtime]
winrt.windowsduplicatestring
winstring/WindowsDuplicateString
winrt\windowsduplicatestring.htm
WinRT
65343F8A-ACD5-4BD2-83CD-DA9F71690DF3
12/05/2018
WindowsDuplicateString, WindowsDuplicateString function [Windows Runtime], winrt.windowsduplicatestring, winstring/WindowsDuplicateString
winstring.h
Windows
Windows 8 [desktop apps \| UWP apps]
Windows Server 2012 [desktop apps \| UWP apps]
Windows
19H1
WindowsDuplicateString
winstring/WindowsDuplicateString
c++
APIRef
kbSyntax
DllExport
winstring.h
API-MS-Win-Core-WinRT-String-l1-1-0.dll
ComBase.dll
API-MS-Win-Core-WinRT-String-L1-1-1.dll
WindowsDuplicateString

-description

Creates a copy of the specified string.

-parameters

-param string

Type: [in] HSTRING

The string to be copied.

-param newString

Type: [out] HSTRING*

A copy of string.

-returns

Type: HRESULT

This function can return one of these values.

Return code Description
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.

-see-also

WindowsCreateString

WindowsCreateStringReference

WindowsDeleteString