> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XUserResolveIssueWithUiUtf16Result

> XUserResolveIssueWithUiUtf16Result

# XUserResolveIssueWithUiUtf16Result

擷取 [XUserResolveIssueWithUiUtf16Async](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiutf16async) 呼叫的結果。

## 語法

```cpp theme={null}
HRESULT XUserResolveIssueWithUiUtf16Result(  
         XAsyncBlock* async  
)  
```

### 參數

*async*   \_Inout\_\
類型：XAsyncBlock\*

傳遞給 [XUserResolveIssueWithUiUtf16Async](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiutf16async) 的 [XAsyncBlock](/zh-TW/reference/system/xasync/structs/xasyncblock)。

### 傳回值

類型：HRESULT

如果成功，會傳回 S\_OK；否則會傳回錯誤碼。
如需錯誤碼的清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

| 傳回碼 | 描述 |
| - | - |
| S\_OK | 作業成功 |
| E\_ABORT | 使用者已取消作業 |

## 備註

如果 XUsers API 傳回 E\_GAMEUSER\_RESOLVE\_USER\_ISSUE\_REQUIRED 錯誤，使用者必須與系統使用者介面 (UI) 互動以解決問題。
呼叫 [XUserResolveIssueWithUiUtf16Async](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiutf16async) 以顯示適當的系統 UI。

若要顯示系統使用者介面，以使用非 Unicode URL 解決權杖問題，請呼叫 [XUserResolveIssueWithUiAsync](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiasync)。

下列範例示範如何顯示系統 UI，以使用 URL 解決權杖問題。

```cpp theme={null}
HRESULT ResolveUserIssueComplete(XAsyncBlock* ab)
{
    if (SUCCEEDED_LOG(XUserResolveIssueWithUiResult(ab)))
    {
        appLog.AddLog("Successfully Resolved User Issue\n");
    }

    return S_OK;
}

HRESULT ResolveUserIssueUtf16Complete(XAsyncBlock* ab)
{
    if (SUCCEEDED_LOG(XUserResolveIssueWithUiUtf16Result(ab)))
    {
        appLog.AddLog("Successfully Resolved User Issue\n");
    }

    return S_OK;
}

HRESULT ResolveUserIssueWithUiAsync(
    XTaskQueueHandle queue,
    const char* narrowUrl = nullptr,
    const wchar_t* wideUrl = nullptr,
    bool useUtf16 = false)
{
    auto resolveAsyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(resolveAsyncBlock.get(), sizeof(*resolveAsyncBlock));
    resolveAsyncBlock->queue = queue;
    resolveAsyncBlock->context = this;

    if (useUtf16)
    {
        resolveAsyncBlock->callback = [](XAsyncBlock* ab)
        {
            auto asyncBlock = std::unique_ptr<XAsyncBlock>(ab);
            LOG_IF_FAILED(static_cast<User*>(ab->context)->ResolveUserIssueUtf16Complete(ab));
        };

        if (SUCCEEDED_LOG(XUserResolveIssueWithUiUtf16Async(
            _handle.get(),
            wideUrl,
            resolveAsyncBlock.get())))
        {
            // The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take over ownership.
            // If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
            resolveAsyncBlock.release();
        }
    }
    else
    {
        resolveAsyncBlock->callback = [](XAsyncBlock* ab)
        {
            auto asyncBlock = std::unique_ptr<XAsyncBlock>(ab);
            LOG_IF_FAILED(static_cast<User*>(ab->context)->ResolveUserIssueComplete(ab));
        };

        if (SUCCEEDED_LOG(XUserResolveIssueWithUiAsync(
            _handle.get(),
            narrowUrl,
            resolveAsyncBlock.get())))
        {
            // The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take over ownership.
            // If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
            resolveAsyncBlock.release();
        }
    }

    return S_OK;
}
```

## 需求

**標頭：** XUser.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、Steam Deck、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[XUser](/zh-TW/reference/system/xuser/xuser_members)

[XUserResolveIssueWithUiUtf16Async](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiutf16async)

[XUserResolveIssueWithUiAsync](/zh-TW/reference/system/xuser/functions/xuserresolveissuewithuiasync)


## Related topics

- [XUserResolveIssueWithUiUtf16Result](/reference/system/xuser/functions/xuserresolveissuewithuiutf16result.md)
- [XUserResolveIssueWithUiResult](/reference/system/xuser/functions/xuserresolveissuewithuiresult.md)
