ranukano Posted June 30, 2015 Share Posted June 30, 2015 local $guiStyleoriginal = BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW) local $guiStyleremove = BitNOT($WS_POPUPWINDOW)) GUISetStyle(BitXor($guiStyleoriginal, $guiStyleremove))The GUI is originally set with Topmost and Toolwindow. I then have it set with static positioning to remove the programs title bar which applies PopupWindow on top of Topmost and Toolwindow.That works. However when I try to return it to just Topmost and Toolwindow it seems I fail. I've tried numerous ways and read multiple comments, the examples, and the wiki. I'm afraid I've only confused myself and now I'm not sure how to apply this.Though, it could also be that once i apply this style, I'm unable to remove it without restarting. Link to comment Share on other sites More sharing options...
KaFu Posted July 2, 2015 Share Posted July 2, 2015 (edited) That one was a real bugger ...expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinApi.au3> #include <Constants.au3> Local $msg, $a_style Local $hGUI = GUICreate("My GUI", Default, Default, Default, Default, $WS_POPUPWINDOW) $c_button = GUICtrlCreateButton("Change Style", 10, 10, 100, 20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $c_button Then $a_style = GUIGetStyle($hGUI) If BitAND($a_style[0], $WS_POPUPWINDOW) Then ; MSDN - SetWindowLong function ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).aspx ; Certain window data is cached, so changes you make using SetWindowLong will not take effect until you call the SetWindowPos function. Specifically, if you change any of the frame styles, you must call SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be updated properly. _WinAPI_SetWindowLong($hGUI, $GWL_STYLE, BitXOR($a_style[0], $WS_POPUPWINDOW)) _WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR($a_style[1], $WS_EX_TOOLWINDOW)) ; MSDN - Extended Window Styles ; https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx ; WS_EX_TOPMOST = The window should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function. _WinAPI_SetWindowPos($hGUI, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) Else _WinAPI_SetWindowLong($hGUI, $GWL_STYLE, BitOR($a_style[0], $WS_POPUPWINDOW)) _WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitXOR($a_style[1], $WS_EX_TOOLWINDOW)) _WinAPI_SetWindowPos($hGUI, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) EndIf EndIf WEnd GUIDelete() Edited July 2, 2015 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now