Skip to content

Instantly share code, notes, and snippets.

@KawaiiKraken
Created April 14, 2024 20:20
Show Gist options
  • Save KawaiiKraken/94dd5aebf33a5e45677a39ebf20f6428 to your computer and use it in GitHub Desktop.
Save KawaiiKraken/94dd5aebf33a5e45677a39ebf20f6428 to your computer and use it in GitHub Desktop.
press F5 to get the win32 window styles and exstyles of the active window
#NoEnv
#SingleInstance Force
; Define hotkey to trigger the function
F5::GetWindowStyles()
F6::ExitApp
; Function to get window styles and extended window styles of the active window
GetWindowStyles() {
WinGet, style, Style, A
WinGet, exStyle, ExStyle, A
decodedStyle := DecodeWindowStyles(style)
decodedExStyle := DecodeExtendedWindowStyles(exStyle)
MsgBox, Window Styles: %decodedStyle% `n`nExtended Window Styles: %decodedExStyle%
}
; Function to decode window styles
DecodeWindowStyles(style) {
decoded := ""
if (style & 0x800000)
decoded .= "WS_BORDER | "
if (style & 0xC00000)
decoded .= "WS_CAPTION | "
if (style & 0x40000000)
decoded .= "WS_CHILD | "
if (style & 0x40000000)
decoded .= "WS_CHILDWINDOW | "
if (style & 0x2000000)
decoded .= "WS_CLIPCHILDREN | "
if (style & 0x4000000)
decoded .= "WS_CLIPSIBLINGS | "
if (style & 0x8000000)
decoded .= "WS_DISABLED | "
if (style & 0x80000000)
decoded .= "WS_DLGFRAME | "
if (style & 0x400000)
decoded .= "WS_GROUP | "
if (style & 0x100000)
decoded .= "WS_HSCROLL | "
if (style & 0x20000000) ; same as WS_MINIMIZE
decoded .= "WS_ICONIC | "
if (style & 0x1000000)
decoded .= "WS_MAXIMIZE | "
if (style & 0x10000)
decoded .= "WS_MAXIMIZEBOX | "
if (style & 0x20000000)
decoded .= "WS_MINIMIZE | "
if (style & 0x20000)
decoded .= "WS_MINIMIZEBOX | "
if !(style & 0x1) ; default
decoded .= "WS_OVERLAPPED | "
if (style & 0xCF0000)
decoded .= "WS_OVERLAPPEDWINDOW | "
if (style & 0x20000)
decoded .= "WS_POPUP | "
if (style & 0x80880000)
decoded .= "WS_POPUPWINDOW | "
if (style & 0x40000)
decoded .= "WS_SIZEBOX | "
if (style & 0x80000)
decoded .= "WS_SYSMENU | "
if (style & 0x10000)
decoded .= "WS_TABSTOP | "
if (style & 0x40000)
decoded .= "WS_THICKFRAME | "
if !(style & 0x1) ; default
decoded .= "WS_TILED | " ; same as WS_OVERLAPPED
if (style & 0xCF0000)
decoded .= "WS_TILEDWINDOW | "
if (style & 0x10000000)
decoded .= "WS_VISIBLE | "
if (style & 0x200000)
decoded .= "WS_VSCROLL | "
; Remove trailing " | "
decoded := SubStr(decoded, 1, -3)
return decoded
}
; Function to decode extended window styles
DecodeExtendedWindowStyles(exStyle) {
decoded := ""
if (exStyle & 0x10)
decoded .= "WS_EX_ACCEPTFILES | "
if (exStyle & 0x40000)
decoded .= "WS_EX_APPWINDOW | "
if (exStyle & 0x200)
decoded .= "WS_EX_CLIENTEDGE | "
if (exStyle & 0x2000000)
decoded .= "WS_EX_COMPOSITED | "
if (exStyle & 0x400)
decoded .= "WS_EX_CONTEXTHELP | "
if (exStyle & 0x10000)
decoded .= "WS_EX_CONTROLPARENT | "
if (exStyle & 0x1) ; default
decoded .= "WS_EX_DLGMODALFRAME | "
if (exStyle & 0x00080000)
decoded .= "WS_EX_LAYERED | "
if (exStyle & 0x400000)
decoded .= "WS_EX_LAYOUTRTL | "
if !(style & 0x1) ; default
decoded .= "WS_EX_LEFT | "
if (exStyle & 0x4000)
decoded .= "WS_EX_LEFTSCROLLBAR | "
if !(style & 0x1) ; default
decoded .= "WS_EX_LTRREADING | "
if (exStyle & 0x40)
decoded .= "WS_EX_MDICHILD | "
if (exStyle & 0x8000000)
decoded .= "WS_EX_NOACTIVATE | "
if (exStyle & 0x100000)
decoded .= "WS_EX_NOINHERITLAYOUT | "
if (exStyle & 0x4)
decoded .= "WS_EX_NOPARENTNOTIFY | "
if (exStyle & 0x200000)
decoded .= "WS_EX_NOREDIRECTIONBITMAP | "
if (exStyle & 0x300) ; (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
decoded .= "WS_EX_OVERLAPPEDWINDOW | "
if (exStyle & 0x188) ; (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)
decoded .= "WS_EX_PALETTEWINDOW | "
if (exStyle & 0x1000)
decoded .= "WS_EX_RIGHT | "
if !(style & 0x1) ; default
decoded .= "WS_EX_RIGHTSCROLLBAR | "
if (exStyle & 0x2000)
decoded .= "WS_EX_RTLREADING | "
if (exStyle & 0x20000)
decoded .= "WS_EX_STATICEDGE | "
if (exStyle & 0x80)
decoded .= "WS_EX_TOOLWINDOW | "
if (exStyle & 0x8)
decoded .= "WS_EX_TOPMOST | "
if (exStyle & 0x20)
decoded .= "WS_EX_TRANSPARENT | "
if (exStyle & 0x100)
decoded .= "WS_EX_WINDOWEDGE | "
; Remove trailing " | "
decoded := SubStr(decoded, 1, -3)
return decoded
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment