Jump to content

How to wait untill any window is created or closed


E1M1
 Share

Recommended Posts

1)I need method to find if any new windows were created

2)I need to know if any of existing windows are closed

For my 1-st method I tried this

WinWaitActive("")
MsgBox(1,1,WinGetTitle(""))

But its not good method I suppose :)

I cant find method to register if any window is closed.

WinWaitClose("") needs to have given window title, but how to make this command works with out given window?

I actually need something looks like WinWaitCreate(<any>) and WinWaitclose(<any of opened windows>)

I need it because I want create something like taskbar where you can see currently open window names in real time.

Edited by E1M1

edited

Link to comment
Share on other sites

  • Moderators

E1M1,

This post might help you. It lists the active windows in Z-order.

By the way, the thread which contained it was on the first page of the search results for "list+windows".............. ;-)

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

E1M1,

This post might help you. It lists the active windows in Z-order.

By the way, the thread which contained it was on the first page of the search results for "list+windows".............. ;-)

M23

wow nice, thanks

edited

Link to comment
Share on other sites

But how I make GUI now? Cuttently I get lots of buttons and I nothing happens when I click on them, how I make that script thatway I have only 1 row of buttons an when I click on button I want get msng box says text that is on the button I click

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $buffer = ""

$Form1 = GUICreate("Form1", 926, 908, 193, 115)
;~ $Button1 = GUICtrlCreateButton("Button1", 16, 24, 75, 25, 0)
GUISetState(@SW_SHOW)
;~ $i = 1
;~ While 1
;~  $i = $i +1
;~  $nMsg = GUIGetMsg()
;~  Switch $nMsg
;~      Case $GUI_EVENT_CLOSE
;~          Exit
;~  EndSwitch
;~  $button2 = GUICtrlCreateButton("lol",$i * 74,10,75,20)
;~ WEnd
$height = 0
While 1
    ToolTip("")
    $list = WinList()
    If $list[0][0] = 0 Then Exit

    $i = 0

    For $n = 1 to $list[0][0]
        If Not IsVisible($list[$n][1]) Then ContinueLoop
        $i += 1
        If Not StringLen($list[$n][0]) Then
            $buffer &= $i & ": " & GetClassName($list[$n][1]) & @LF
        Else
            $buffer &= $i & ": " & $list[$n][0] & @LF
        EndIf
        $left = $i * 74
        If $left > 900 Then
            $height = $height + 25
        EndIf   
        $button2 = GUICtrlCreateButton(GetClassName($list[$n][1]),$left,$height,75,20)
    Next
    ToolTip($buffer)
    $buffer = ""
    Sleep(1000)
WEnd

Func GetClassName(ByRef $hWnd)
    Local $ret = DLLCall("user32.dll","int","GetClassName","hwnd",$hWnd,"str","","int",5000)
    If IsArray($ret) Then
        Return $ret[2]
    Else
        Return ""
    EndIf
EndFunc

Func IsVisible($handle)
    If BitAnd( WinGetState($handle), 2 ) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

edited

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