GameMonitor Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Allows an app to get the game monitor permission state of the device, and potentially prompt the user to enable game monitoring.
Important
As of Windows 10, version 1809 (10.0; Build 17763), this API is removed from the public API surface of Windows.
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
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v5.0)
|
Examples
The following example asks the customer for consent to enable game monitoring if it's not already enabled:
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.
}
}
Remarks
This class uses TruePlay, a system on Windows 10 that helps to combat cheating in PC games. As of Windows 10, version 1809 (10.0; Build 17763), TruePlay is removed from Windows. A game enrolled in TruePlay will run in a protected process, which mitigates a class of common attacks. The TruePlay APIs for UWP allow limited interaction between games and the game monitoring system on Windows 10 PCs.
You can use these WinRT APIs, in tandem with the native APIs in <gamemonitor.h>, to work with the game monitoring system. The documentation for TruePlay is no longer published.
Methods
GetDefault() |
Gets an instance of the GameMonitor class. Important As of Windows 10, version 1809 (10.0; Build 17763), this API is removed from the public API surface of Windows. |
RequestPermissionAsync() |
Gets the game monitoring permission state of the device. Important As of Windows 10, version 1809 (10.0; Build 17763), this API is removed from the public API surface of Windows. |