StungStang Posted January 10, 2011 Share Posted January 10, 2011 (edited) Hi to all, i've to do a simple question, but i don't know the function to do this... For example i would like to know if "my programm gui is selected", there are a function to do that (sure yes, autoit powa ?...and if it was "on top" it give a simple msgbox. P.S. How i can make my gui always on top and switch it to "always on top on" and "always on top off" with a button? Thank's a lot Hi to all Edited January 10, 2011 by StungStang Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 10, 2011 Moderators Share Posted January 10, 2011 StungStang,Dog eaten your Help file? i would like to know if "my programm gui is selected"Use WinGetState and check if the GUI is active.How i can make my gui always on top?- 1. Create the GUI with $WS_EX_TOPMOST extended style.- 2. Use WinSetOnTop.The online Help file is here, by the way. 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 Link to comment Share on other sites More sharing options...
StungStang Posted January 10, 2011 Author Share Posted January 10, 2011 I see a lot on help file, but if you don't know how function is named, is very hard to find it =P How i can always force my gui to always on top, if i've press te button "always on top on" ? With WinSetOnTop() it dont force all time my gui, but with $WS_EX_TOPMOST i can't put my gui in "always on top off" Hi thank's for help Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 10, 2011 Moderators Share Posted January 10, 2011 StungStang,but with $WS_EX_TOPMOST i can't put my gui in "always on top offYes you can. Just remove the style when you no longer need it. The Setting Styles tutorial in the Wiki tells you how to do this. 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 Link to comment Share on other sites More sharing options...
StungStang Posted January 10, 2011 Author Share Posted January 10, 2011 I've write this code : #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 357, 189, 304, 240) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem3 = GUICtrlCreateMenuItem("Always on top", $MenuItem1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem3 If BitAND (GUICtrlRead ($MenuItem3),$GUI_UNCHECKED) Then GUICtrlSetStyle($Form1,$WS_EX_TOPMOST) ;Dont work GUICtrlSetState ($MenuItem3,$GUI_CHECKED) ElseIf BitAND (GUICtrlRead ($MenuItem3),$GUI_CHECKED) Then GUICtrlSetState ($MenuItem3,$GUI_UNCHECKED) ;How to set normal gui? EndIf EndSwitch WEnd But unfortunatly dont work ...any fix ? Link to comment Share on other sites More sharing options...
Raupi Posted January 10, 2011 Share Posted January 10, 2011 (edited) GUICtrlSetStyle is for Controls and not for a GUI. Here is a Example with WinSetOnTop: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 357, 189, 304, 240) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem3 = GUICtrlCreateMenuItem("Always on top", $MenuItem1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem3 Local $Attrib = BitAND(GUICtrlRead($MenuItem3), $GUI_CHECKED) Switch $Attrib Case 0 GUICtrlSetState($MenuItem3, $GUI_CHECKED) Case 1 GUICtrlSetState($MenuItem3, $GUI_UNCHECKED) EndSwitch $Attrib = Not $Attrib WinSetOnTop($Form1, "", $Attrib) EndSwitch WEnd Edited January 10, 2011 by Raupi Link to comment Share on other sites More sharing options...
StungStang Posted January 10, 2011 Author Share Posted January 10, 2011 Ok this is my solution, thanks for your help #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 357, 189, 304, 240) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem3 = GUICtrlCreateMenuItem("Always on top", $MenuItem1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem3 If BitAND (GUICtrlRead ($MenuItem3),$GUI_UNCHECKED) Then GUICtrlSetState($MenuItem3,$GUI_CHECKED) WinSetOnTop($Form1, "", 1) ElseIf BitAND (GUICtrlRead ($MenuItem3),$GUI_CHECKED) Then GUICtrlSetState ($MenuItem3,$GUI_UNCHECKED) WinSetOnTop($Form1, "", 0) EndIf EndSwitch WEnd Hi Link to comment Share on other sites More sharing options...
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