Determining whether game mode is active

trym flogard 21 Reputation points
2021-09-18T11:02:48.807+00:00

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

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,420 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 81,636 Reputation points
    2021-09-18T12:09:19.52+00:00

    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
    }
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful