(The original code came from Laszlo's taskbar clock).
You can either use the title of a program's window to identify the parent or if you use the function I commented out below instead, then you can use the class's name.
; e.g. run an internet explorer window and go to the page: "about:blank" so that is the start of the title text ; then run this script and it adds a gui window onto the internet explorer window. ; Some programs, such as notepad and calculator, don't seem to work properly with this technique. Gui, 7: Margin, 0, 0 Gui, 7: +ToolWindow ; -Caption ; no title, no taskbar icon Gui, 7: Add, Text,, This gui is stuck to the parent... `nbut I haven't programmed it to do anything `;-) Set_Parent_by_title("about:blank", 7) ; can be done before or after showing the gui Gui, 7: Show, x200 y200 Return /* or to use the window id of the parent instead of the title: Set_Parent_by_id(Window_ID, Gui_Number) ; title text is the start of the title of the window, gui number is e.g. 99 { Gui, %Gui_Number%: +LastFound Return DllCall("SetParent", "uint", WinExist(), "uint", Window_ID) ; success = handle to previous parent, failure =null } */ Set_Parent_by_title(Window_Title_Text, Gui_Number) ; title text is the start of the title of the window, gui number is e.g. 99 { WinGetTitle, Window_Title_Text_Complete, %Window_Title_Text% Parent_Handle := DllCall( "FindWindowEx", "uint",0, "uint",0, "uint",0, "str", Window_Title_Text_Complete) Gui, %Gui_Number%: +LastFound Return DllCall( "SetParent", "uint", WinExist(), "uint", Parent_Handle ) ; success = handle to previous parent, failure =null } /* or to use the class instead of the title: Set_Parent_by_class(Window_Class, Gui_Number) ; class e.g. Shell_TrayWnd, gui number is e.g. 99 { Parent_Handle := DllCall( "FindWindowEx", "uint",0, "uint",0, "str", Window_Class, "uint",0) Gui, %Gui_Number%: +LastFound Return DllCall( "SetParent", "uint", WinExist(), "uint", Parent_Handle ) ; success = handle to previous parent, failure =null } */