VPet-Simulator – AHK Script to Remove The Window from The Alt-Tab List

I keep accidentally tabbing into the vpet window instead of the application I want to, I figured since its always on top it doesn’t need an alt tab entry.

How It Works

The script modifies the window type into a palette window which by default doesnt have an alt-tab entry.
To use it:

  • Launch the script using autohotkey
  • Press CTRL+ALT+F12 while the vpet is the focused window
  • You can now safely exit the script from your system tray

Also useful to know that you can toggle it back on with the same keyboard shortcut

The Script

; Initialize an empty object to store window data
data := {}

; Define the hotkey Ctrl + Alt + F12
  ; Get the ID of the active window
  WinGet, hw, ID, A

  ; Check if the window ID is valid and not 0
  if ((hw != "") && (hw != 0)) {
    ; Check if the window data exists for this window ID
    if (data[hw]) {
      ; If window data exists, remove the specified extended style from the window
      WinSet, ExStyle, % data[hw], ahk_id %hw%
      data.Delete(hw) ; Remove the window data entry
    } else {
      ; If no window data exists, get the current extended style of the window
      WinGet, es, ExStyle, ahk_id %hw%
      ; Store the current extended style in the data object
      data[hw] := es
      ; Add a specific extended style (0x80) to the window's extended style
      WinSet, ExStyle, % (es | 0x80), ahk_id %hw%
return ; End of the hotkey subroutine

Further Explanation

The WinSet function is used to modify various window attributes. In this script, it’s primarily used to manipulate the extended style of windows. The extended style (ExStyle) of a window controls various visual aspects and behaviors. By toggling the extended style value using the | (bitwise OR) operator, the script can add or remove specific attributes from the window’s ExStyle, effectively changing its appearance or behavior.

Extended styles are a set of attributes that control various visual and behavioral aspects of a window. These styles can be manipulated using the `ExStyle` parameter of the `WinSet` function in AutoHotkey. In this script, the `winset exstyle` command is used to add or remove the extended style associated with the value `0x80` from the window’s existing extended style.

The specific extended style being manipulated here, `0x80`, corresponds to the `WS_EX_TOOLWINDOW` style. This style affects how the window is displayed in the taskbar and Alt+Tab switcher.


  • This style makes a window a tool window, which means it won’t appear in the Alt+Tab switcher by default.
  • Tool windows are intended for auxiliary dialogs or floating tool palettes that should not appear in the taskbar or Alt+Tab list.
  • By adding this style to a window, you’re essentially hiding it from the Alt+Tab list.

In summary, the script uses the `WinSet` function to toggle the `WS_EX_TOOLWINDOW` extended style on and off for a specified window, effectively controlling whether that window appears in the Alt+Tab switcher or not. When the script adds this style to a window’s extended style, the window is hidden from the Alt+Tab list, and when the style is removed, the window reappears in the Alt+Tab list.

Helena Stamatina
About Helena Stamatina 3012 Articles
I love two things in life, games and sports. Although sports were my earliest interest, it was video games that got me completely addicted (in a good way). My first game was Crash Bandicoot (PS1) from the legendary studio Naughty Dog back in 1996. I turned my passion for gaming into a job back in 2019 when I transformed my geek blog (Re-actor) into the gaming website it is today.

Be the first to comment

Leave a Reply

Your email address will not be published.