DoofGore Posted March 19, 2018 Posted March 19, 2018 Hello All, My first post I know this is pretty noobish but I'm trying to find a way to make this gui working.. searched but as I'm new to autoit I don't understand much... I want to make this gui on top if we press ON TOP button and off on top function when we press on top off.. Created gui with koda ... any help would be appreciated Regards, #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 353, 209, 192, 114) Global $ONTOPON = GUICtrlCreateButton("ON TOP ON", 32, 40, 137, 65) Global $exit = GUICtrlCreateButton("EXIT", 105, 118, 137, 65) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $ONTOPOFF = GUICtrlCreateButton("ON TOP OFF", 184, 41, 137, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ONTOPON Case $ONTOPOFF Case $exit Exit EndSwitch WEnd
Moderators Melba23 Posted March 19, 2018 Moderators Posted March 19, 2018 DoofGore, WinSetOnTop should be the solution for which you are looking. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
DoofGore Posted March 19, 2018 Author Posted March 19, 2018 Hello Melba23 I am playing around with WinSetOnTop but i didn't really understand it... it would be great if someone just explain how this is gona work.. Sorry for this noobish post..
Moderators JLogan3o13 Posted March 19, 2018 Moderators Posted March 19, 2018 @DoofGore Did you read the help file entry for WinSetOnTop? It explains what it does pretty simply. Where exactly are you confused? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
DoofGore Posted March 19, 2018 Author Posted March 19, 2018 1 minute ago, JLogan3o13 said: @DoofGore Did you read the help file entry for WinSetOnTop? It explains what it does pretty simply. Where exactly are you confused? I am confused how to write this function to set the gui on top on button click : Can you please provide some examples? So I can learn it how to make this function work.. Thanks
Bilgus Posted March 19, 2018 Posted March 19, 2018 (edited) UH there is an example in the helpfile? https://www.autoitscript.com/autoit3/docs/functions/WinSetOnTop.htm ;Example #include <AutoItConstants.au3> Example() Func Example() ; Retrieve the handle of the active window. Local $hWnd = WinGetHandle("[ACTIVE]") ; Set the active window as being ontop using the handle returned by WinGetHandle. WinSetOnTop($hWnd, "", $WINDOWS_ONTOP) ; Wait for 2 seconds to display the change. Sleep(2000) ; Remove the "topmost" state from the active window. WinSetOnTop($hWnd, "", $WINDOWS_NOONTOP) EndFunc ;==>Example expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 353, 209, 192, 114) Global $ONTOPON = GUICtrlCreateButton("ON TOP ON", 32, 40, 137, 65) Global $exit = GUICtrlCreateButton("EXIT", 105, 118, 137, 65) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $ONTOPOFF = GUICtrlCreateButton("ON TOP OFF", 184, 41, 137, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ONTOPON Example($Form1, True) Case $ONTOPOFF Example($Form1, False) Case $exit Exit EndSwitch WEnd Func Example($hWnd, $bTrue) If Not IsHwnd($hWnd) Then Msgbox(0,"Error" "Invalid hWnd") If $bTrue Then ; Set the active window as being ontop using the handle YOU supply. WinSetOnTop($hWnd, "", $WINDOWS_ONTOP) Else ; Remove the "topmost" state from the handle YOU supply. WinSetOnTop($hWnd, "", $WINDOWS_NOONTOP) EndIF EndFunc ;==>Example #include <AutoItConstants.au3> If Not IsHwnd($hWnd) Then Msgbox(0,"Error", "Invalid hWnd") Edited March 19, 2018 by Bilgus Couple Errors.. DoofGore 1
DoofGore Posted March 19, 2018 Author Posted March 19, 2018 @Bilgus Thank you so much .... This is what i was asking for .. will give it a try now...
DoofGore Posted March 19, 2018 Author Posted March 19, 2018 (edited) Made Some changes and its working.. Thank you so much ... expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 353, 209, 192, 114) Global $ONTOPON = GUICtrlCreateButton("ON TOP ON", 32, 40, 137, 65) Global $exit = GUICtrlCreateButton("EXIT", 105, 118, 137, 65) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $ONTOPOFF = GUICtrlCreateButton("ON TOP OFF", 184, 41, 137, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ONTOPON Example($Form1, True) Case $ONTOPOFF Example($Form1, False) Case $exit Exit EndSwitch WEnd Func Example($Form1, $bTrue) ; Retrieve the handle of the active window. Local $hWnd = WinGetHandle("[ACTIVE]") If $bTrue Then ; Set the active window as being ontop using the handle returned by WinGetHandle. WinSetOnTop($hWnd, "", $WINDOWS_ONTOP) Else ; Wait for 2 seconds to display the change. Sleep(2000) ; Remove the "topmost" state from the active window. WinSetOnTop($hWnd, "", $WINDOWS_NOONTOP) EndIf EndFunc ;==>Example Edited March 19, 2018 by DoofGore
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