question

trymflogard-6801 avatar image
0 Votes"
trymflogard-6801 asked RoyLi-MSFT edited

Determining whether game mode is active

Is there an API for determining whether the user is currently playing a game, or running another graphics accelerated application in fullscreen?

windows-api-generalwindows-api-uiwindows-api-system-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered

A way is with IDirectDraw7
(tested on Windows 10 1909 (in a Timer for the test) with various games in Full Screen) =>

 BOOL bRet = FALSE;
 IDirectDraw7 *pDD7;
 if (SUCCEEDED(CoCreateInstance(CLSID_DirectDraw7, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IDirectDraw7, &pDD7))))
 {
     if (S_OK == pDD7->Initialize(NULL))
     {
         bRet = pDD7->TestCooperativeLevel() == DDERR_EXCLUSIVEMODEALREADYSET;
         pDD7->Release();
     }
 }
 if (bRet)
 {
         // Full Screen game is running
 }


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.