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

# XUserFindUserByLocalId

> XUserFindUserByLocalId

# XUserFindUserByLocalId

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

## 構文

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

### パラメーター

*userLocalId*   \_In\_\
Type: [XUserLocalId](/reference/system/xuser/structs/xuserlocalid)

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

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

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

### 戻り値

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

Type: HRESULT

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

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

## 解説

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

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

ローカル ユーザーの XBOX ユーザー ID (XUID) を取得するには、[XUserFindUserById](/reference/system/xuser/functions/xuserfinduserbyid) を呼び出します。

特定のデバイス 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)

## 関連項目

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

[XUserFindUserById](/reference/system/xuser/functions/xuserfinduserbyid)

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


## Related topics

- [XUserFindUserById](/ja-jp/reference/system/xuser/functions/xuserfinduserbyid.md)
- [XUserLocalId](/ja-jp/reference/system/xuser/structs/xuserlocalid.md)
- [XUserGetId](/ja-jp/reference/system/xuser/functions/xusergetid.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)
