Changes the style or extended style of the specified window, respectively.
WinSetStyle Value , WinTitle, WinText, ExcludeTitle, ExcludeText WinSetExStyle Value , WinTitle, WinText, ExcludeTitle, ExcludeText
Type: Integer or String
Pass a positive integer to completely overwrite the window's style; that is, to set it to Value.
To easily add, remove or toggle styles, pass a numeric string prefixed with a plus sign (+), minus sign (-) or caret (^), respectively. The new style value is calculated as shown below (where CurrentStyle could be retrieved with WinGetStyle/WinGetExStyle):
If Value is a negative integer, it is treated the same as the corresponding numeric string.
To use the + or ^ prefix literally in an expression, the prefix or value must be enclosed in quote marks. For example:
WinSetStyle("^" StylesToToggle). This is because the expression
+123 produces 123 (without a prefix) and
^123 is a syntax error.
Type: String, Integer or Object
A window title or other criteria identifying the target window. See WinTitle.
If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText is ON.
Windows whose titles include this value will not be considered.
Windows whose text include this value will not be considered.
An exception is thrown if the window could not be found or the change could not be applied.
See the styles table for a partial listing of styles.
After applying certain style changes to a visible window, it might be necessary to redraw the window using WinRedraw.
The ID of the window under the mouse cursor can be retrieved with MouseGetPos.
Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.
WinGetStyle / WinGetExStyle, ControlSetStyle / ControlSetExStyle, styles table, Win functions, Control functions
#1: Removes the active window's title bar (WS_CAPTION):
WinSetStyle "-0xC00000", "A"
#1: Toggles the WS_EX_TOOLWINDOW attribute, which removes/adds Notepad from the alt-tab list:
WinSetExStyle "^0x80", "ahk_class Notepad"