Jump to content
Sign in to follow this  
Craberos

GUI always on top

Recommended Posts

Craberos

hello all

thanks for all the help provided

can anyone tell me the code to

1. make a GUI always on top

thanks

craberos

Edited by Craberos

Share this post


Link to post
Share on other sites
zorphnog

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

Share this post


Link to post
Share on other sites
Craberos

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

Share this post


Link to post
Share on other sites
simon387

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

Share this post


Link to post
Share on other sites
Craberos

#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

Share this post


Link to post
Share on other sites
somdcomputerguy

Use the extended style $WS_EX_TOPMOST in GUICreate.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Craberos

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

Share this post


Link to post
Share on other sites
somdcomputerguy

Use GUICreate("T", 140, 260, -1, -1, Default, $WS_EX_TOPMOST).

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Craberos

Use GUICreate("T", 140, 260, -1, -1, Default, $WS_EX_TOPMOST).

thanks a ton somdcomputerguy it worked like a charm :idea: thanks you

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  

×