Jump to content

child window


Recommended Posts

Credits and thanks to Melba for creating this code.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Run("Notepad")
WinWaitActive("Untitled - Notepad")

; Create My_GUI and use TOPMOST
Global $hMy_GUI = GUICreate("My GUI", 300, 300, 20, 20, -1, $WS_EX_TOPMOST)
GUISetState(@SW_HIDE)

; Set visible flag (assuming it is visible to begin with!)
Global $fMy_GUI_Vis = False
; Declare last position variables
Global $iLast_X = 0
Global $iLast_Y = 0

While 1

    ; Other loop code
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit

    ; Correct position of My_GUI if required
    If WinActive("Untitled - Notepad") Or WinActive($hMy_GUI) Then
        $aExternal_Pos = WinGetPos("Untitled - Notepad")
        If IsArray($aExternal_Pos) Then
            If $aExternal_Pos[0] <> $iLast_X Or $aExternal_Pos[1] <> $iLast_Y Then
                $iLast_X = $aExternal_Pos[0]
                $iLast_Y = $aExternal_Pos[1]
                WinMove($hMy_GUI, "", $aExternal_Pos[0] + 40, $aExternal_Pos[1] + 60)
            EndIf
        EndIf
    EndIf

    ; Hide My_GUI when External not active
    If BitAND(WinGetState("Untitled - Notepad"), 8) <> 8 And $fMy_GUI_Vis = True Then
        GUISetState(@SW_HIDE, $hMy_GUI)
        $fMy_GUI_Vis = False
    ElseIf BitAND(WinGetState("Untitled - Notepad"), 8) = 8 And $fMy_GUI_Vis = False Then
        GUISetState(@SW_SHOW, $hMy_GUI)
        $fMy_GUI_Vis = True
    EndIf

    ; Reactivate External when My_GUI is activated
    If WinActive($hMy_GUI) Then
        WinActivate("Untitled - Notepad")
    EndIf

WEnd

how can i change it so this method of hiding and showing your GUI will work with multiple GUI's?

Edit: Oops, forgot to post code >_<

Edited by Hypertrophy
Link to comment
Share on other sites

Link to comment
Share on other sites

  • Moderators

Hypertrophy,

It is not difficult - you just have to replicate all the code for each additional GUI. And I am not doing it for you. >_<

But the whole script slows down as you each additional GUI, so you might find the result less than satisfactory if yo add too many.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Well that sucks >_< I guess I'm back at square one then. What I'm trying to understand is how to make windows in autoit that can follow around and "copy" the window I tell it to. Making it a child is not enough I suppose. I want the window I make to minimize with an external window, to follow it around, and to hide when the external window is out of focus? Is this possible?

Link to comment
Share on other sites

  • Moderators

Hypertrophy,

What do you mean by "copy"?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

What I mean is when the "parent" window minimizes, so does all the of the little windows I created on it. When the "parent" window moves, the little windows i created on it move with it. When the "parent" window goes behind another window, so does the little windows I assigned to it.

Link to comment
Share on other sites

  • Moderators

Hypertrophy,

I am afraid that is way beyond my hobbyist coding ability. The code you have is as far as I have ever gone.

Good luck!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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