> ## 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.

# XUserFindUserById

> XUserFindUserById

# XUserFindUserById

ローカル ユーザーの XBOX ユーザー ID (XUID) に基づいて XUserHandle を取得します。

## 構文

```cpp theme={null}
HRESULT XUserFindUserById(  
         uint64_t userId,  
         XUserHandle* handle  
)  
```

### パラメーター

*userId*   \_In\_\
Type: uint64\_t

XUID を取得する対象のローカル ユーザーです。

*handle*   \_Out\_\
Type: XUserHandle\*

ローカル ユーザーの XUID が格納されます。

### 戻り値

Type: HRESULT

HRESULT の成功またはエラー コード。\
エラー コードの一覧については、[エラー コード](/reference/errorcodes) を参照してください。

## 解説

<Note>この関数は、時間依存スレッドから呼び出しても安全ではありません。詳細については、[時間依存スレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。</Note>

**XUserFindUserById** を含む **XUser** API から取得した **XUserHandle** ハンドルは、いずれも [XUserCloseHandle](/reference/system/xuser/functions/xuserclosehandle) を呼び出して閉じる必要があります。

ローカル ユーザーの XBOX ユーザー ID (XUID) を取得するには、XUserFindUserById を呼び出します。

特定のローカル ユーザー ID に対応するユーザーへのハンドルを取得するには、[XUserFindUserByLocalId](/reference/system/xuser/functions/xuserfinduserbylocalid) を呼び出します。

特定のデバイス ID に対応するユーザー ID を取得するには、[XUserFindForDevice](/reference/system/xuser/functions/xuserfindfordevice) を呼び出します。

## 要件

**ヘッダー:** XUser.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、Steam Deck、XBOX One ファミリ本体および XBOX Series 本体

## 概念ドキュメント

* [時間依存スレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)
* [Game Chat 2 C++ API の使用](/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2)

## 関連項目

[XUser](/reference/system/xuser/xuser_members)

[XUserFindUserByLocalId](/reference/system/xuser/functions/xuserfinduserbylocalid)

[XUserFindForDevice](/reference/system/xuser/functions/xuserfindfordevice)


## Related topics

- [XUserFindUserByLocalId](/ja-jp/reference/system/xuser/functions/xuserfinduserbylocalid.md)
- [XUserGetId](/ja-jp/reference/system/xuser/functions/xusergetid.md)
- [Game Chat 2 C++ API の使用](/ja-jp/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md)
- [XUser](/ja-jp/reference/system/xuser/xuser_members.md)
- [GDK 向け Unity C# API ラッパー](/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
