次の方法で共有


GameMonitor クラス

定義

アプリがデバイスのゲーム モニターのアクセス許可の状態を取得できるようにし、ゲームの監視を有効にするようにユーザーに求める可能性があります。

重要

Windows 10 Version 1809時点 (10.0;ビルド 17763)、この API は Windows のパブリック API サーフェイスから削除されます。

public ref class GameMonitor sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class GameMonitor final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class GameMonitor
Public NotInheritable Class GameMonitor
継承
Object Platform::Object IInspectable GameMonitor
属性

Windows の要件

デバイス ファミリ
Windows 10 Fall Creators Update (10.0.16299.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v5.0 で導入)

次の例では、まだ有効になっていない場合は、ゲームの監視を有効にすることに同意するよう顧客に求めます。

void DisplayGameMonitoringConsentUI() 
{ 
    auto gameMonitor = Windows::Gaming::UI::GameMonitor::GetDefault(); 

    if (gameMonitor != nullptr) 
    { 
        create_task(gameMonitor->RequestPermissionAsync())
            .then([this] (GameMonitoringPermission permissionState) 
            { 
                if (permissionState == GameMonitoringPermission::Allowed) 
                { 
                    // Continue with gaming experience. 
                } 
                else if (permissionState == GameMonitoringPermission::DeniedByUser
                    || permissionState == GameMonitoringPermission::DeniedBySystem) 
                { 
                    // Game has attempted mitigation. The game will likely exit. 
                }
            }); 
    } 
    else 
    { 
        // This is game-dependent - some games may proceed, others 
        // may require game monitoring for some scenarios, etc. 
    } 
} 

注釈

このクラスでは、Pc ゲームでの不正行為に対処するのに役立つWindows 10上のシステムである TruePlay を使用します。 Windows 10、バージョン 1809 (10.0; ビルド 17763) の時点で、TruePlay は Windows から削除されています。 TruePlay に登録されているゲームは、保護されたプロセスで実行されるため、一般的な種類の攻撃が軽減されます。 UWP 用の TruePlay API を使用すると、Windows 10 PC 上のゲームとゲーム監視システム間の対話が制限されます。

これらの WinRT API は、gamemonitor.h> の<ネイティブ API と連携して、ゲーム監視システムと連携して使用できます。 TruePlay のドキュメントは発行されなくなりました。

メソッド

GetDefault()

GameMonitor クラスのインスタンスを取得します。

重要

Windows 10 Version 1809時点 (10.0;ビルド 17763)、この API は Windows のパブリック API サーフェイスから削除されます。

RequestPermissionAsync()

デバイスのゲーム監視アクセス許可の状態を取得します。

重要

Windows 10 Version 1809時点 (10.0;ビルド 17763)、この API は Windows のパブリック API サーフェイスから削除されます。

適用対象

こちらもご覧ください