Always On Top inside Parent Window?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
samardac
Posts: 212
Joined: 30 Nov 2014, 13:36

Always On Top inside Parent Window?

10 Jul 2015, 05:47

Hi I have this code where I have Main window as Parent and two windows Child1 and Child2 inside it.
How to make Child2 tobe Always On Top inside Main(Parent) Window?

Code: Select all

; create and display main GUI

Gui, Main: New, +HwndmainGuiId +Resize, Main GUI
Gui, Main: Show, w600 h150 


Gui, Child: New, +ParentMain +HwndchildGuiId, ChildGUI
Gui, Child: Add, Text,,this is child gui
Gui, Child: Show, x0 y0 w200 h100


Gui, Child2: New, +ParentMain +HwndchildGuiId, Child GUI 2
Gui, Child2: Add, Text,,this is child gui
Gui, Child2: Show, x100 y0 w200 h100

return
just me
Posts: 9458
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Always On Top inside Parent Window?

10 Jul 2015, 08:07

e.g.

Code: Select all

; create and display main GUI

Gui, Main: New, +HwndmainGuiId +Resize, Main GUI
Gui, Main: Show, w600 h150


Gui, Child: New, +ParentMain +HwndchildGuiId1, Child GUI 1
Gui, Child: Add, Text,,this is child gui
Gui, Child: Show, x0 y0 w300 h100


Gui, Child2: New, +ParentMain +HwndchildGuiId2, Child GUI 2
Gui, Child2: Add, Text,,this is child gui
Gui, Child2: Show, x100 y0 w300 h100

WinSet, Top, , ahk_id %childGuiID2%
OnMessage(0x0022, "ChildActivate") ; WM_CHILDACTIVATE

return

MainGuiClose:
ExitApp

ChildActivate() {
   If (A_Gui <> "Main") && (A_Gui <> "Child2") {
      Gui, Child2:+LastFound
      WinSet, Top
   }
}
samardac
Posts: 212
Joined: 30 Nov 2014, 13:36

Re: Always On Top inside Parent Window?

10 Jul 2015, 08:34

Many thanks!!!
Last edited by samardac on 10 Jul 2015, 11:41, edited 1 time in total.
samardac
Posts: 212
Joined: 30 Nov 2014, 13:36

Re: Always On Top inside Parent Window?

10 Jul 2015, 11:41

But how to be if I use Inside parent third party window not ahk GUI (by using SetParent DLL)? How catch that I activated it?
WM_CHILDACTIVATE does not work, I tried ShelHook with HSHELL_WINDOWACTIVATED but it also does not work.
How to cath that External window to make Child2 to be always on top?
Last edited by samardac on 10 Jul 2015, 11:50, edited 3 times in total.
samardac
Posts: 212
Joined: 30 Nov 2014, 13:36

Re: Always On Top inside Parent Window?

10 Jul 2015, 11:48

This is the code:

Code: Select all

run Notepad

Gui, Main: +HwndmainGuiId  
Gui, Main: +LastFound 

Gui, Main: Show, w600 h150

Gui, Child2: New, +ParentMain +HwndchildGuiId2, Child GUI 2
Gui, Child2: Add, Text,,this is child gui
Gui, Child2: Show, x100 y0 w300 h100

External:=WinExist("Untitled")
DllCall("SetParent", "uint", External, "uint", mainGuiId  )

WinMove, ahk_id %External%,, 0,0
WinSet, Top, , ahk_id %childGuiID2%

return
ahklearner
Posts: 313
Joined: 23 Jan 2015, 01:49

Re: Always On Top inside Parent Window?

11 Jul 2015, 02:20

Thanks for the great stuff.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Google [Bot], wineguy and 330 guests