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

# XDisplayAcquireTimeoutDeferral

> XDisplayAcquireTimeoutDeferral

# XDisplayAcquireTimeoutDeferral

画面タイムアウトの延期を取得します。

## Syntax

```cpp theme={null}
HRESULT XDisplayAcquireTimeoutDeferral(  
         XDisplayTimeoutDeferralHandle* handle  
)  
```

### Parameters

*handle*   \_Out\_\
型: XDisplayTimeoutDeferralHandle\*

画面タイムアウトの延期のハンドルへのポインター。

### Return value

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

成功した場合は **S\_OK** を返します。それ以外の場合はエラー コードを返します。エラー コードの一覧については、[Error Codes](/reference/errorcodes) を参照してください。

## Remarks

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

画面タイムアウトの延期により、ユーザーが何も操作しない間も画面が暗くなったり、ロックされたり、電源が切れたりしないようにします。一定のアイドル時間が経過すると、画面タイムアウトが発生します。画面タイムアウトが発生すると、デバイスはディスプレイを暗くしたり、ロック画面をアクティブにしたり、ディスプレイの電源を切ったりする場合があります。画面タイムアウトが発生するのに必要なアイドル時間の長さは、デバイスのユーザー設定によって異なります。ゲームがユーザーの操作を必要としないアクティビティ (ゲーム リソースの読み込みや長いカットシーンの表示など) を実行している場合、画面タイムアウトは不便な場合があります。画面タイムアウトの延期を取得することで、画面タイムアウトを防止できます。

画面タイムアウトの延期を取得するには、まず **XDisplayAcquireTimeoutDeferral** を呼び出して画面タイムアウトの延期のハンドルを取得し、そのハンドルが不要になったら [XDisplayCloseTimeoutDeferralHandle](/reference/system/xdisplay/functions/xdisplayclosetimeoutdeferralhandle) を呼び出してハンドルを閉じます。ゲームがフォーカスを失うと画面タイムアウトの延期は無視され、ゲームが終了すると解放されます。

<Note>この関数を使用して画面タイムアウトの延期ハンドルを取得した場合、**XDisplayCloseTimeoutDeferralHandle** を呼び出してそのハンドルを閉じる必要があります。複数の画面タイムアウトの延期ハンドルを取得することができ、すべての画面タイムアウトの延期ハンドルが閉じられた後にのみ、ゲームで画面タイムアウトが有効になります。</Note>

<Note>タイトルがアクティブにデバッグされている間は、画面の減光は行われません。</Note>

次の例では、**XDisplayAcquireTimeoutDeferral** を呼び出して新しい画面タイムアウトの延期ハンドルを取得した後、長い導入カットシーンを再生します。新しいハンドルが正常に取得された場合、ユーザーの非操作による画面タイムアウトなしで長い導入カットシーンを再生できます。カットシーンの再生が完了したら、この例は **XDisplayCloseTimeoutDeferralHandle** を呼び出してハンドルを閉じます。すべての画面タイムアウトの延期ハンドルが閉じられた後は、ユーザーの非操作による画面タイムアウトが再び発生する可能性があります。

```cpp theme={null}
void Game::PlayIntroCutscene()
{
    XDisplayTimeoutDeferralHandle handle;

    // Try to acquire a new timeout deferral handle.
    if (SUCCEEDED(XDisplayAcquireTimeoutDeferral(&handle)))
    {
        // The newly-opened timeout deferral handle prevents the display
        // from dimming over the game if the user goes idle.
        // 
        // At this point, the long intro cutscene can play without dimmming.
    }

    // Once the cutscene has completed playing, 
    // close the timeout deferral handle.
    XDisplayCloseTimeoutDeferralHandle(handle);

    // If there are no open timeout deferral handles, the display can
    // once again dim over the game if the user goes idle.
}
```

## Requirements

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

[XDisplayCloseTimeoutDeferralHandle](/reference/system/xdisplay/functions/xdisplayclosetimeoutdeferralhandle)\
[XDisplay](/reference/system/xdisplay/xdisplay_members)


## Related topics

- [XDisplayCloseTimeoutDeferralHandle](/ja-jp/reference/system/xdisplay/functions/xdisplayclosetimeoutdeferralhandle.md)
- [XDisplay](/ja-jp/reference/system/xdisplay/xdisplay_members.md)
- [GDK 向け Unity C# API ラッパー](/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XBOX Game Streaming 向けにゲームを最適化する](/ja-jp/build/core-features/common/game-streaming/game-streaming-optimizing-your-game.md)
- [IGameInputDevice::AcquireExclusiveRawDeviceAccess](/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_acquireexclusiverawdeviceaccess.md)
