建立指定字串的複本。
語法
HRESULT WindowsDuplicateString(
HSTRING string,
HSTRING *newString
);
參數
string
類型:[in] HSTRING
要複製的字串。
newString
類型:[out] HSTRING*
字串的副本。
返回值
類型:HRESULT
此函式可以傳回其中一個值。
| 回傳碼 | Description |
|---|---|
|
HSTRING 已複製成功。 |
|
newString 為 NULL。 |
|
無法配置新的 HSTRING。 |
備註
使用 WindowsDuplicateString 函式來複製 HSTRING。 如果 字串 是藉由呼叫 WindowsCreateString 函式建立,則支援緩衝區的參考計數會遞增。 如果 字串 是藉由呼叫 WindowsCreateStringReference 函式來建立,Windows 執行階段會將其來源字串複製到新的緩衝區,並啟動參考計數,這表示 newString 不是快速傳遞字串。
每個 WindowsDuplicateString 函式的呼叫都必須與 WindowsDeleteString 的對應呼叫相符。
需求
| Requirement | 價值觀 |
|---|---|
| 最低支援的用戶端 | Windows 8 [傳統型應用程式 |UWP 應用程式] |
| 支援的最低伺服器 | Windows Server 2012 [傳統型應用程式 |UWP 應用程式] |
| 目標平臺 | 窗戶 |
| Header | winstring.h |
| Library | mincore.lib |