Search code examples
c++windowsqtregistrysteam

C++ Qt - Check if a steam game is running or not programmatically


I wanted to know if there is a way to check if a steam game is running or not programatically, knowing its steamid, on Windows. I know about the fact that each game has its registry key in which there is a Running value. However, this value doesn't seem to work for all games. For example, it works for me for Undertale : it updates instantly both on opening and closure. The issue is Rocket League running value doesn't change at opening. I don't know if this issue happens for other games, or if it's only happening with Rocket League, but the solution doesn't seem to be good enough in this case.

The reason I ask this is because running the game from an external program only retrieves steam.exe process id and not the actual game process id so I'm stuck to checking manually.

Thanks in advance!


Solution

  • For people who are wondering, I found a solution. At HKEY_CURRENT_USER\Software\Valve\Steam there is a RunningAppID value which will take the currently running game steamid as value. This one has been 100% reliable until now for me so I believe it's the solution I was seeking for. Hopefully it helps you too.