Jump to content
Sign in to follow this  
Simucal

Set $WS_EX_TOPMOST with GuiSetStyle() problem

Recommended Posts

Trying to make a checkbox that allows switching between the extended style "Topmost" and the default/having topmost off.

Am I just being dense and missing something simple?

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 151, 70, 193, 125)
$Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 24, 24, 97, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1
            If GuiCtrlRead($CheckBox1) = $GUI_CHECKED Then
                MsgBox(0, "Info", "Setting form to always on top.")
                GuiSetStyle(-1, $WS_EX_TOPMOST, $Form1)
            Else
                MsgBox(0, "Info", "Setting form to back to default style.")
                GuiSetStyle(-1, -1, $Form1)
            EndIf
    EndSwitch
WEnd

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 151, 70, 193, 125)
$Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 24, 24, 97, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
        if $nMsg=$GUI_EVENT_CLOSE then Exit
        If GuiCtrlRead($CheckBox1) = $GUI_CHECKED Then
            MsgBox(0, "Info", "Setting form to always on top.")
            GuiSetStyle(-1, $WS_EX_TOPMOST, $Form1)
        Else
            MsgBox(0, "Info", "Setting form to back to default style.")
            GuiSetStyle(-1, -1, $Form1)
        EndIf
WEnd

With me it functions

Share this post


Link to post
Share on other sites

Trying to make a checkbox that allows switching between the extended style "Topmost" and the default/having topmost off.

Am I just being dense and missing something simple?

...oÝ÷ Ûú®¢×y¨l¢g°z*Ýë,È(x(«x¬¶ëZ)ÒzÓ§N_ºw-âË^iÒ!j÷§z÷«§Z*k¡¹^Ì"¶­jëh×6#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 151, 70, 193, 125)
$Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 24, 24, 97, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1
            If GuiCtrlRead($CheckBox1) = $GUI_CHECKED Then
                WinSetOnTop($Form1,"",True)
            Else
                WinSetOnTop($Form1,"",False)
            EndIf
    EndSwitch
WEnd

This is just a workaround, but it works flawlessly for me now. Also, take notice that it uses the GUI handle and not the title. This makes it always work for your GUI, even if other GUIs are running with the same title.

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 151, 70, 193, 125)
$Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 24, 24, 97, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
        if $nMsg=$GUI_EVENT_CLOSE then Exit
        If GuiCtrlRead($CheckBox1) = $GUI_CHECKED Then
            MsgBox(0, "Info", "Setting form to always on top.")
            GuiSetStyle(-1, $WS_EX_TOPMOST, $Form1)
        Else
            MsgBox(0, "Info", "Setting form to back to default style.")
            GuiSetStyle(-1, -1, $Form1)
        EndIf
WEnd

With me it functions

With me it isnt properly setting the GuiStyle.. so I'll get the msgbox's but it hasn't really been set to $WS_EX_TOPMOST. Windows still can be placed over it.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

This is just a workaround, but it works flawlessly for me now. Also, take notice that it uses the GUI handle and not the title. This makes it always work for your GUI, even if other GUIs are running with the same title.

- The Kandie Man ;-)

Thanks, I didn't know about that function. I'll use it for now.

I wonder if it is documented somewhere that you cant dynamically change the attribute $WS_EX_TOPMOST with GuiSetStyle?


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...