Jump to content

GUI always on top


Recommended Posts

WinSetOnTop. Look at the help file, it's there for a reason.

that did not work

i need to make the gui created by autoit to be always on top

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()


Func Example()
    Local $button_1,$button_2, $button_3, $button_4
    Local $Halt, $msg

    Opt("GUICoordMode", 1)
    GUICreate("T", 140, 260)

    $button_1 = GUICtrlCreateButton("Earth", 20, 20, 100, 40)
    $button_2 = GUICtrlCreateButton("Water", 20, 80, 100, 40)
    $button_3 = GUICtrlCreateButton("Fire", 20, 140, 100, 40)
    $button_4 = GUICtrlCreateButton("Air", 20, 200, 100, 40)
    
        
    GUISetState()
    
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE
                
            Case $msg = $button_1
                WinActivate ("Earth")
            Case $msg = $button_2
                WinActivate ("Water")
            Case $msg = $button_3
                WinActivate ("Fire")
            Case $msg = $button_4
                WinActivate ("Air")
                            
            Case $Halt = $msg 

        EndSelect
    WEnd
EndFunc
Edited by Craberos
Link to comment
Share on other sites

that did not work

i need to make the gui created by autoit to be always on top

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()


Func Example()
    Local $button_1,$button_2, $button_3, $button_4
    Local $Halt, $msg

    Opt("GUICoordMode", 1)
    GUICreate("T", 140, 260)

    $button_1 = GUICtrlCreateButton("Earth", 20, 20, 100, 40)
    $button_2 = GUICtrlCreateButton("Water", 20, 80, 100, 40)
    $button_3 = GUICtrlCreateButton("Fire", 20, 140, 100, 40)
    $button_4 = GUICtrlCreateButton("Air", 20, 200, 100, 40)
    
        
    GUISetState()
    
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE
                
            Case $msg = $button_1
                WinActivate ("Earth")
            Case $msg = $button_2
                WinActivate ("Water")
            Case $msg = $button_3
                WinActivate ("Fire")
            Case $msg = $button_4
                WinActivate ("Air")
                            
            Case $Halt = $msg 

        EndSelect
    WEnd
EndFunc

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()


Func Example()
    Local $button_1,$button_2, $button_3, $button_4
    Local $Halt, $msg

    Opt("GUICoordMode", 1)
    GUICreate("T", 140, 260)

    $button_1 = GUICtrlCreateButton("Earth", 20, 20, 100, 40)
    $button_2 = GUICtrlCreateButton("Water", 20, 80, 100, 40)
    $button_3 = GUICtrlCreateButton("Fire", 20, 140, 100, 40)
    $button_4 = GUICtrlCreateButton("Air", 20, 200, 100, 40)
    WinSetOnTop("T", "", 1)

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE

            Case $msg = $button_1
                WinActivate ("Earth")
            Case $msg = $button_2
                WinActivate ("Water")
            Case $msg = $button_3
                WinActivate ("Fire")
            Case $msg = $button_4
                WinActivate ("Air")

            Case $Halt = $msg

        EndSelect
    WEnd
EndFunc
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()


Func Example()
    Local $button_1,$button_2, $button_3, $button_4
    Local $Halt, $msg

    Opt("GUICoordMode", 1)
    GUICreate("T", 140, 260)

    $button_1 = GUICtrlCreateButton("Earth", 20, 20, 100, 40)
    $button_2 = GUICtrlCreateButton("Water", 20, 80, 100, 40)
    $button_3 = GUICtrlCreateButton("Fire", 20, 140, 100, 40)
    $button_4 = GUICtrlCreateButton("Air", 20, 200, 100, 40)
    WinSetOnTop("T", "", 1)

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE

            Case $msg = $button_1
                WinActivate ("Earth")
            Case $msg = $button_2
                WinActivate ("Water")
            Case $msg = $button_3
                WinActivate ("Fire")
            Case $msg = $button_4
                WinActivate ("Air")

            Case $Halt = $msg

        EndSelect
    WEnd
EndFunc

i copied your code and tried it is not working

Link to comment
Share on other sites

Use the extended style $WS_EX_TOPMOST in GUICreate.

i had to include "#include <WindowsConstants.au3>" and it worked but previously it was centered now it is on the left corner of the desktop any solutions

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

Opt('MustDeclareVars', 1)

Example()


Func Example()
    Local $button_1,$button_2, $button_3, $button_4
    Local $Halt, $msg

    Opt("GUICoordMode", 1)
    GUICreate("T", 140, 260,$WS_EX_TOPMOST)
    
    
    
    $button_1 = GUICtrlCreateButton("Earth", 20, 20, 100, 40)
    $button_2 = GUICtrlCreateButton("Water", 20, 80, 100, 40)
    $button_3 = GUICtrlCreateButton("Fire", 20, 140, 100, 40)
    $button_4 = GUICtrlCreateButton("Air", 20, 200, 100, 40)
    
    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE

            Case $msg = $button_1
                WinActivate ("Earth")
            Case $msg = $button_2
                WinActivate ("Water")
            Case $msg = $button_3
                WinActivate ("Fire")
            Case $msg = $button_4
                WinActivate ("Air")

            Case $Halt = $msg

        EndSelect
    WEnd
EndFunc
Edited by Craberos
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...