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

# XGameGetXboxTitleId

> XGameGetXboxTitleId

# XGameGetXboxTitleId

ゲームの TitleID を返します。

## Syntax

```cpp theme={null}
HRESULT XGameGetXboxTitleId(  
         uint32_t* titleId  
)  
```

### Parameters

*titleId*   \_Out\_\
型: uint32\_t\*

ゲームの TitleID へのポインター。

### Return value

型: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

成功した場合は **S\_OK** を返します。それ以外の場合はエラー コードを返します。エラー コードの一覧については、[Error Codes](/reference/errorcodes) を参照してください。ゲーム開発者が MicrosoftGame.config ファイルに TitleID を構成していない場合、戻り値は **HRESULT\_FROM\_WIN32(ERROR\_NOT\_FOUND)** に設定されます。

## Remarks

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

TitleID は、XBOX Live サービスに対してゲームを一意に識別します。これは、ユーザーがゲームの Live コンテンツ (ユーザー統計や実績など) にアクセスできるようにし、Live のマルチプレイヤー機能を有効にするために、XBOX Live サービス全体で使用されます。TitleID は、ゲームの MicrosoftGame.config マニフェスト ファイルに保存されます。

次の例は、ゲームが使用するバックエンド REST サービスを呼び出すための URL を生成します。**XGameGetXBoxTitleId** 関数を呼び出して、TitleID を URL の一部として含めます。

```cpp theme={null}
std::string GetBackendServiceUrl()  
{  
    uint32_t titleId;  
  
    RetailAssert(SUCCEEDED(XGameGetXboxTitleId(&titleId)));  
  
    std::stringstream url;  
    url << "https://example.com/some/api/call";  
  
    url << std::hex << std::uppercase << std::setfill('0');  
    url << "/titleId/" << std::setw(8) << titleId;  
  
    return url.str();  
}   
```

## Requirements

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

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

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

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[MicrosoftGame.config](/build/core-features/common/game-config/MicrosoftGameConfig-toc)\
[XGame](/reference/system/xgame/xgame_members)\
[Setting up sandboxes for XBOX Live development](/services/xbox-services/fundamentals/sandboxes/live-setting-up-sandboxes)


## Related topics

- [XGame](/ja-jp/reference/system/xgame/xgame_members.md)
- [MicrosoftGame.config 要素 - TitleId](/ja-jp/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [XblAchievementsGetAchievementsForTitleIdAsync](/ja-jp/reference/live/xsapi-c/achievements_c/functions/xblachievementsgetachievementsfortitleidasync.md)
- [XblAchievementsGetAchievementsForTitleIdResult](/ja-jp/reference/live/xsapi-c/achievements_c/functions/xblachievementsgetachievementsfortitleidresult.md)
- [PFServiceConfigGetTitleId](/ja-jp/services/playfab/api-references/c/pfserviceconfig/functions/pfserviceconfiggettitleid.md)
