Fr33b0w Posted April 1, 2014 Share Posted April 1, 2014 It has been probably answered somewhere. I did a search and find something similar ('?do=embed' frameborder='0' data-embedContent>>) but that doesnt solve my problem. Have been trough other posts but I couldnt find it. I did look at those but could find nothing...: Gui On Top On Top Of Windows 7 Start Menu (06 Sep 2013) Make A Button Visible When Notepad Is Opened (09 Sep 2013) Turn Off Monitor When Shutdown Button Pressed From Start Menu (10 Sep 2013) What I Am Doing Wrong (11 Sep 2013) Winapi Drawshadowtext (16 Sep 2013) Duplicate Mouse Clicks (17 Sep 2013) How Can I Create A Custom Shaped Gui Interface (25 Sep 2013) Set An Array Variable With Unknown Number (24 Sep 2013) Knowing If A Gui Is Clicked Or Not Im Using Gdiplus To Make A Png Gui Want To Know If Someone Clicks It (27 Sep 2013) Login Script Check Wordpress Credentials Via Php Function Using Inet (29 Sep 2013) Console Or Dunno (30 Sep 2013) Font Change (29 Sep 2013) Another Exe In My Gui (29 Sep 2013) How To Use Chat Engine To Get Adresses And Ad Them To My Script (30 Sep 2013) Script Consumes Too Much Memory Please Help Me Find Where (18 Nov 2013) Detect Leaving Of Inputbox And Change Listview Item (01 Nov 2013) Is Posible Create Gui Effects With Autoitobject (18 Nov 2013) Png Image Design (25 Nov 2013) Getting Event When File Is Dragged To Input Field (09 Dec 2013) Wmp Visualization Help (16 Dec 2013) Remote Computer Command Help (17 Dec 2013) Edit Autohvscroll (21 Dec 2013) Trying To Read Url From Chrome Yes Still And Again (12 Jan 2014) Console Transpert In My Gui (01 Jan 2014) Problem Drawingdeleting Lines With Gdiplus Graphicsdrawline (07 Jan 2014) Question Gui Dropaccepted (10 Jan 2014) Chnaging The Taskbar Clock Format (12 Jan 2014) Greater Than (16 Jan 2014) Winsetontop Taking Focus (22 Jan 2014) Need Help On Creating Dialog Box With Text (18 Jan 2014) Problem Extracting Folders Icon (19 Jan 2014) Attaching Element To Existing Gui (24 Jan 2014) Alternative To Guictrlsetgraphic (23 Jan 2014) I am trying to get GUI toggle ontop and not ontop. Part of the code I want to put it in is: #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> $hGUI = GUICreate("Toggle Not Working", 171, 699, -1, -1) GUICtrlSetStyle(-1, $SS_RIGHT) GUICtrlSetFont(-1, 8.5, 400, 0, "MS Shell Dlg", 5) $oIE = ObjCreate("Shell.Explorer.2") GUICtrlSetStyle(-1, $SS_RIGHT) $hOntop = GUICtrlCreateButton("", 142, 628, 21, 21) GUICtrlSetStyle(-1, $BS_ICON) GUICtrlSetImage(-1, "ontop.ico") GUISetState() Select Case $hMsg = $hButton1 ClipPut(FileReadLine($file,206)) Case $hMsg = $hButton207 ClipPut(FileReadLine($file,207)) Case $hMsg = $hOntop GUICtrlSetState(-1, $WS_EX_TOPMOST) EndSelect I did tried with two buttons but couldnt switch it not to be on top. Because I already posting it would like to see an example with toggle if someone knows (with just one button). Thanks. Link to comment Share on other sites More sharing options...
Solution KaFu Posted April 1, 2014 Solution Share Posted April 1, 2014 #include <GUIConstantsEx.au3> $hGUI = GUICreate("Toggle Not Working", 200, 200) $c_Button_Ontop = GUICtrlCreateButton("Not OnTop", 10, 10, 140, 21) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $c_Button_Ontop Then _ToogleOnTop() WEnd Func _ToogleOnTop() Switch GUICtrlRead($c_Button_Ontop) Case "Not OnTop" WinSetOnTop($hGUI,"",1) GUICtrlSetData($c_Button_Ontop,"OnTop") Case Else WinSetOnTop($hGUI,"",0) GUICtrlSetData($c_Button_Ontop,"Not OnTop") EndSwitch EndFunc Fr33b0w 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 1, 2014 Moderators Share Posted April 1, 2014 (edited) Fr33b0w,This works for me: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Toggle Working", 171, 699, -1, -1) GUICtrlSetFont(-1, 8.5, 400, 0, "MS Shell Dlg", 5) $oIE = ObjCreate("Shell.Explorer.2") $hOntop = GUICtrlCreateButton("Set On Top", 102, 628, 61, 21) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hOntop If GUICtrlRead($hOntop) = "Set On Top" Then WinSetOnTop($hGUI, "", 1) GUICtrlSetData($hOntop, "Set NOT On Top") Else WinSetOnTop($hGUI, "", 0) GUICtrlSetData($hOntop, "Set On Top") EndIf EndSwitch WEndM23Edit: Guten tag, KaFu. Ich war zu langsam heute! Edited April 1, 2014 by Melba23 Fr33b0w 1 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...
Fr33b0w Posted April 1, 2014 Author Share Posted April 1, 2014 Guys, thank You very much! Both answers work for me. I already put KaFus in a script but Melbas goes without Subfunction... Which one should I mark as better (solved)? Dont want to hurt anyones feelings... Again, many thanks! Link to comment Share on other sites More sharing options...
guinness Posted April 1, 2014 Share Posted April 1, 2014 Function is easier to understand, though I would pass as params. Fr33b0w 1 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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