consume_soil Posted February 20, 2022 Posted February 20, 2022 Hello. I don't know why, but when I have a script that calls a function twice, which creates a gui and puts it ontop. However, only one of them remains ontop. I tried searching the forums but couldn't find anything. Is there any way to work around this? #include <GUIConstantsEx.au3> Display() Display() Func Display() GUICreate("Example", 250, 250) GUISetState() WinSetOnTop("Example", "", 1) EndFunc While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd
Nine Posted February 20, 2022 Posted February 20, 2022 Use hWnd instead of title, as Windows cannot know which one is which. Like this : Func Display() Local $hGUI = GUICreate("Example", 250, 250) GUISetState() WinSetOnTop($hGUI, "", 1) EndFunc “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
ad777 Posted April 1, 2022 Posted April 1, 2022 (edited) @consume_soil expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #RequireAdmin Global $inc, $TMP, $rTes Display() ;Display 1 Display() ;Display 2 Func Display() $GUI = GUICreate("Example", 250, 250) GUISetState() $inc = $inc + 1 $TMP &= WinGetHandle($GUI) & "-" & $inc & ']' Sleep(100) $Display = 2;Display 2 $test = _SetOnTop($TMP, '', 1, $Display);set window on top which is -> Display 2 EndFunc ;==>Display Func _SetOnTop($title, $text, $flag, $displaynum) if $displaynum = $inc Then $Last = StringInStr($title, $inc & ']') - 2 For $i = 1 To StringLen($title) Step 2 if StringMid($title, StringInStr($title, $inc & ']') - $i, 2) = '0x' Then ExitLoop Else $rTes &= StringReverse(StringMid($title, $Last - $i, 2)) EndIf Next Return WinSetOnTop(Ptr(StringReverse($rTes)), $text, $flag) EndIf EndFunc ;==>_SetOnTop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Edited April 1, 2022 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want.
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