It is possible. You need to find the mechanism by which the game checks to see if it in the foreground will trick it into thinking that the switch did not happen. This will require a certain amount of reverse engineering on your part. There are many different ways that this check can actually be performed in the game.
You can try playing with the connection of one of the following messages / functions: WM_KILLFOCUS , WM_ACTIVATE , GetForegroundWindow . On the other hand, a game might do something funky with DirectX. I don't have much experience.
To repeat the iteration, to do it right, you really need to figure out exactly how the game will test (and then undermine it).
source share