This is a pretty specific example, but is there a way to know if your in a menu screen or not in a game? I have a little app running in the background and will respond to a 'hot key' pressed at anytime. I would like to limit when that hotkey will actually work, hence knowing what screen I'm in with in the game.

I've been using SPY++ to watch a game window and from what I can tell, you can't really tell whats going on inside the window, just what is being sent to and from. Is there a way to know whats going on inside a window, if you are looking for something specific?

If it is possible, I'm sure its pretty advanced, but I would still like to get the idea or logic on how one would perform such a task...