Search code examples
c#.netwindowssystem

Efficient way to Switch to Desktop or my program in all cases?


I'm making an important notification program, so I MUST make sure that when the event (notification condition met) occurs, the user has to see it. However, I haven't yet found a way that can switch to my program (or at least, desktop) from all games.

Is there an efficient way to switch to desktop in all cases (3D games, maybe with game protection like Game Guard, ..., other full-screen programs)?


Solution

  • You're fighting a losing battle here. What if two programs did this?

    You think that your program's notifications are of paramount importance, and are willing to do anything to cause them to interrupt whatever the user is doing.

    The apps you're fighting against (often games) feel that their fully-immersive user experience is critical to the user's experience, and as such are willing to do anything that they can to prevent other apps from stealing their focus.

    What do you think is going to happen? Whom do you think is going to win?

    The answer, of course, is irrelevant. But one thing is certain: the user is the one who is going to lose. Just like the kid always loses when his parents are fighting, regardless of which parent wins that particular argument.

    In my mind, whatever application currently has the focus is the one that should win the battle, and most users feel the same way. So strongly, in fact, did users feel about this that Microsoft has recently tightened up the restrictions in Windows on the ability of other apps to steal the foreground focus.

    As usual, Windows doesn't offer the feature that you're requesting because no one ever considered that your app would be so amazingly awesome as to need such a feature. Sorry about your bonus.


    Edit: In case the answer wasn't obvious from the above discussion, the solution is to display a normal notification, such as in the taskbar's Notification Area. The user will see it when they finish playing the game, or whenever it is otherwise convenient for them. That's about all you can or should do.