Check if some game is currently running and on top
I am creating a keybind program for one game. So far it works perfectly but I constantly minimize this game to IM or do something else. So.. How do I make my program work when I got this game on top and when the game is mini开发者_运维百科mized the program shouldn't work.
If you're talking about the app that currently has the focus (like, WOW when it is full screen and you're playing, for example), then you should check out this tutorial. It's a tutorial on how to build an app that keeps track of what applications have been actively used. In the tutorial it explains how to use "user32.dll" to get the title of the active window. You could then, in your app, just check to see if the active title is the app that you want to have your app function or not, and then proceed or cancel accordingly.
精彩评论