Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
Created January 13, 2013 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kissgyorgy/4521498 to your computer and use it in GitHub Desktop.
Save kissgyorgy/4521498 to your computer and use it in GitHub Desktop.
AutoIt: Set window style in runtime
; For explanation, see this forum topic: http://www.autoitscript.com/forum/topic/147424-disable-or-remove-close-minimize-maximize-buttons-on-any-window-in-runtime/
#include <WinAPI.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
$h = WinGetHandle("Untitled - Note")
$iOldStyle = _WinAPI_GetWindowLong($h, $GWL_STYLE)
ConsoleWrite("+ old style: " & $iOldStyle & @CR)
;~ $iNewStyle = BitXOr($iOldStyle, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX)
$iNewStyle = BitXOr($iOldStyle, $WS_SYSMENU)
_WinAPI_SetWindowLong($h, $GWL_STYLE, $iNewStyle)
_WinAPI_SetWindowPos($h, 0, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment