Pause the game if the player "exits" it

Hi there! Our game "RETURN" has grown a little bit since we last posted anything. We now have a pause menu, and many other things. It actually works moving to another room and creating an object that can be controled by the user.

As the game will be fullscreen all the time, the player can exit it by pressing the windows key, but the game continues even though he's no longer using the program. What we wanna do is whenever the player exits the game (but the program is still running; it appears in the taskbar) it moves to the pause room.

Is there any way to do that? We don't event know what to check for... Thank you in advance!
if !window_has_focus()
    if room != rm_paus_room room_goto(rm_paus_room);
Maybe something like this.
Yeah! That worked perfectly!! We only had to change our pause system; we had if ("you are pressing the pause button") { [...] }, so we have put an or operator and an and inside;
if ((keyboard_check_pressed(vk_escape)) or (!window_has_focus() and room!= rm_pause)) {

// Big code here!!