Jump to content

gui on top of specific window


Recommended Posts

Is it possible to make a GUI to appear on top of a specific none autoit window (essentially a child I guess)? So if said window is behind another window, this gui will also be below that top window...but on top of said window. I found _WinAPI_SetParent, but that seems to only apply to windows from the same app.

I found the following thread that may be able to solve my immediate need where if the window isn't visible I wont create the gui, but I don't quite understand how to implement it.

Any help on either front? Thanks.

Link to comment
Share on other sites

simple example:

; https://www.autoitscript.com/forum/topic/211404-gui-on-top-of-specific-window/

#include <WindowsConstants.au3>

;Check if Win is running else start it
If Not WinExists("[CLASS:Notepad]") Then  Run("notepad.exe")

WinWait("[CLASS:Notepad]", "", 5)

If WinActivate("[CLASS:Notepad]") Then
    Local $Host_Hwnd = WinGetHandle("[CLASS:Notepad]")
Else
    Exit
EndIf

Local $hGUI = GUICreate("MyGUI", 100, 25, -100, -100, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_NOACTIVATE), $Host_Hwnd)
Local $idButton_Copy = GUICtrlCreateButton("Copy", 0, 0, 50, 25)
Local $idButton_Paste = GUICtrlCreateButton("Paste", 50, 0, 50, 25)
GUISetState(@SW_SHOW, $hGUI)

WinActivate($Host_Hwnd)

Local $Host_Pos
;**********************************
While 1

    If Not WinExists($Host_Hwnd) Then Exit

    If WinActive($Host_Hwnd) Then
        $Host_Pos = WinGetPos($Host_Hwnd)
        WinMove($hGUI, "", $Host_Pos[0] + 150, $Host_Pos[1] + 3)
    EndIf

    Switch GUIGetMsg()
        Case -3 ;$GUI_EVENT_CLOSE
            ExitLoop

        Case $idButton_Copy
            WinActivate($Host_Hwnd)
            Send("^c")

        Case $idButton_Paste
            WinActivate($Host_Hwnd)
            Send("^v")

    EndSwitch
    Sleep(10)
WEnd
;**********************************

extended example:  209749-sharexexe-colorpicker/

Edited by ioa747

I know that I know nothing

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...