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

# XUserFindUserByLocalId

> XUserFindUserByLocalId

# XUserFindUserByLocalId

特定のローカル ユーザー ID に対応するユーザーへのハンドルを取得します。

## 構文

```cpp theme={null}
HRESULT XUserFindUserByLocalId(  
         XUserLocalId userLocalId,  
         XUserHandle* handle  
)  
```

### パラメーター

*userLocalId*   \_In\_\
Type: [XUserLocalId](https://docs.xbox.com/ja-jp/reference/system/xuser/structs/xuserlocalid.md)

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

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

特定のローカル ユーザー ID に関連付けられたユーザーへのハンドルが格納されます。

### 戻り値

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

Type: HRESULT

HRESULT の成功またはエラー コード。

| 戻り値コード | 説明 |
| - | - |
| S\_OK | 操作は成功しました。 |
| HRESULT\_FROM\_WIN32(ERROR\_NOT\_FOUND) | ユーザーが見つかりませんでした。 |

## 解説

**XUserFindUserByLocalId** を含む **XUser** API から取得した **XUserHandle** ハンドルは、いずれも [XUserCloseHandle](https://docs.xbox.com/ja-jp/reference/system/xuser/functions/xuserclosehandle.md) を呼び出して閉じる必要があります。Get / Find 関数を呼び出すと、ハンドルの参照カウントが増加します。

特定のローカル ユーザー ID に対応するユーザーへのハンドルを取得するには、XUserFindUserByLocalId を呼び出します。

ローカル ユーザーの XBOX ユーザー ID (XUID) を取得するには、[XUserFindUserById](https://docs.xbox.com/ja-jp/reference/system/xuser/functions/xuserfinduserbyid.md) を呼び出します。

特定のデバイス ID に対応するユーザー ID を取得するには、[XUserFindForDevice](https://docs.xbox.com/ja-jp/reference/system/xuser/functions/xuserfindfordevice.md) を呼び出します。

## 要件

**ヘッダー:** 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)

## 関連項目

[XUser](https://docs.xbox.com/ja-jp/reference/system/xuser/xuser_members.md)

[XUserFindUserById](https://docs.xbox.com/ja-jp/reference/system/xuser/functions/xuserfinduserbyid.md)

[XUserFindForDevice](https://docs.xbox.com/ja-jp/reference/system/xuser/functions/xuserfindfordevice.md)


## Related topics

- [XUserFindUserById](https://docs.xbox.com/ja-jp/reference/system/xuser/functions/xuserfinduserbyid.md)
- [XUserLocalId](https://docs.xbox.com/ja-jp/reference/system/xuser/structs/xuserlocalid.md)
- [XUserGetId](https://docs.xbox.com/ja-jp/reference/system/xuser/functions/xusergetid.md)
- [XUser (API の内容)](https://docs.xbox.com/ja-jp/reference/system/xuser/xuser_members.md)
- [Unity プロジェクトでの GDK API 用 C# ラッパーの使用](https://docs.xbox.com/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
