Jump to content

Changing GUI Topmost Exstyle


Beege
 Share

Recommended Posts

So I cant seem to get the Topmost style to change. Is destroying/recreating the gui the only way to do this? Thanks.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $NewStyle = False, $hWnd, $Style, $GuiStyles, $Msg
    $hWnd = GUICreate("Gui Style", 260, 100)
    $Style = GUICtrlCreateButton("Set Style", 45, 50, 150, 20)
    $GuiStyles = GUIGetStyle($hWnd)
    GUISetState()
    While 1
        $Msg = GUIGetMsg()
        Switch $Msg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Style
                If Not $NewStyle Then
                    GUISetStyle(BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)); Topmost not changing
                    GUICtrlSetData($Style, 'Undo Style')
                    $NewStyle = True
                Else
                    GUISetStyle($GuiStyles[0], $GuiStyles[1])
                    GUICtrlSetData($Style, 'Set Style')
                    $NewStyle = False
                EndIf
            Case Else
        EndSwitch
    WEnd
EndFunc   ;==>Example
Link to comment
Share on other sites

Use the function WinSetOnTop on the window handle returned by GUICreate.

Well that was dumb of me :)

Thankyou!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...