Is there any method for C # XNA games that determines if the user pressed the cross button to close the program, or pressed ALT + F4 to close ..?
The ALT + F4 keys can probably be found on KeyBoardState, but how can I detect the click of a cross button to close the window?
I need this so that I can turn off all threads running when the user closes the game by any means. I currently have some streams still running when the game closes, which makes the music still play: P
Note that this method must be compatible with Windows and the Xbox 360, as the game should work on both of these platforms (maybe Zune too).
source share