Jump to content

How do I have 2 windows with the same title always on top?


consume_soil
 Share

Recommended Posts

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


 

Link to comment
Share on other sites

  • 1 month later...

@consume_soil

#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 by ad777

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...