Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if computer is in gaming mode

Tags:

c++

windows

Background

I'm implementing a simple WIN32 application consist of a window. The user may show/hide the window using a special hotkey. I register the hotkey using RegisterHotKey and respond to WM_HOTKEY

Problem

if user plays a game and accidentally (or not accidentally) press the hotkey combination, then my window pops up and as a result the game is minimized.

Question

Is there a (native) way to know that the user is in gaming mode, or any other special mode, that I could disable the hotkey response

Note

I would also like if windows would make this a feature while I play games. For example don't respond to WinKey+D while I'm in gaming mode.

like image 705
idanshmu Avatar asked Apr 19 '16 16:04

idanshmu


Video Answer


1 Answers

You can use the SHQueryUserNotificationState function to determine whether the user is playing a full screen D3D game. It will report QUNS_RUNNING_D3D_FULL_SCREEN.

like image 91
Raymond Chen Avatar answered Oct 22 '22 08:10

Raymond Chen