GameMaker: Window commands extension

Yesterday I made a GameMaker: Studio extension that provides a bunch of utility functions:

  • Allows to minimize/maximize/restore the window on demand.
  • Allows to disable/enable minimize button, maximize button, close button, and window movement.
  • Allows to override behavior for when minimize/maximize/close buttons are clicked.

It is available for free via; Some examples of uses follow.

Minimize the game window

If you've enabled "borderless window" option in Global Game Settings, you might want a custom "minimize" button, but the built-in functions can't offer you one. This extension does, though:


Which is what you would run when the button is clicked and the game should be minimized.

Disable the close-button

This is made easy enough because there's a function just for this:

Create Event:

    window_command_set_active(window_command_close, false);

To re-enable the close-button, you would call the same function but with true as second argument.

Note that while this will disable closing the game via the button or Alt+F4, tools like Task Manager would still work, so you should only use this to hint that current operation should not be interrupted.

Show confirmation dialog on closing the game

Create Event:


Step Event:

    if (window_command_check(window_command_close)) {
        if (show_question("Are you sure you want to exit?")) game_end();

window_command_hook overrides the given command (in this case, close-action), instead changing an internal variable. Then, when window_command_check is called, the variable' state is returned and it is reset, meaning that the function will return true once after the act.

So in this case, when the game detects that a close-button was clicked, it displays a yes/no dialog and closes the game if the user clicks "yes".

Enter fullscreen mode on "maximize"

Oddly enough, this is what the extension was originally made for - utilizing the "maximize" button in an otherwise-not-resizeable application window to allow the user to enter full screen mode in a click.

Create Event:

    window_command_set_active(window_command_maximize, true);

Step Event:

    if (window_command_check(window_command_maximize)) {

The logic is much akin to what was shown before - the button is enabled and hooked. Then, when it is clicked, the game enters the fullscreen mode.

In conclusion

This is honestly a pretty simple extension that only does a few things, but does them well.

Download (

Related posts:

12 thoughts on “GameMaker: Window commands extension

  1. Is it possable to give window_command a window handle to change the window it is targeting with its functions?

    • In context of window_frame extension, no – the reason it has re-implementations of Window Commands functions is that the “frame” window isn’t even in the same process.

  2. window_command_set_active(window_command_close, false) disables the window buttons but doesn’t disable alt+f4 for me. what do I do?

  3. Hi!
    Great functions, however, I can’t really get them to work somehow…

    I wrote this:
    if current_time-last_click < 1000
    { window_command_run(window_command_minimize) ; }
    last_click = current_time ; make the window minimize on double click. The debugger shows that the function is read, but the game window doesn't minimize :S … Any clues to what I'm doing wrong?


    • P.S.
      I’m on Windows 10, using Gamemaker Studio 2, if that help.
      Also the game seems to compile correctly without errors.
      Maybe I’m just using the function wrong?

      • You can take a look at the demo project that comes with the extension – it has a test button for minimizing the window.

        • Thanks for the tip!

          I did some debugging and got the same problems in the demo though … What I realised was that the function didn’t work when assigning it to the pressing of a mouse button,
          however when using keyboard-buttons – as in the demo – it worked as expected.
          I figured maybe Windows somehow forces the window to stay up when pressing it (?) so I tried to use a mouse_button_release instead, and it worked!
          I hope I made myself clear.
          Thanks again for great functions though!

          • Yo! Many thanks to your debugging. I was havin’ the same problem. Thanks again :)

  4. Hello you would have an extension with a GM8 function for GMS
    “Let the game window always stay on top”? tanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.