Sign in to follow this  
Followers 0
Hypertrophy

how to search for and delete only child windows

4 posts in this topic

Is there a way where I can display every child window that exists and delete it after?

Share this post


Link to post
Share on other sites



Is there a way where I can display every child window that exists and delete it after?

I don't know of a "GetChildren", but there is a "GetParent" so you could list all windows and check on who the parent is:
#include <WinAPI.au3>
#include <Array.au3>

Global $avWinList = WinList()
ReDim $avWinList[UBound($avWinList)][4]
$avWinList[0][1] = "HWND"
$avWinList[0][2] = "Parent HWND"
$avWinList[0][3] = "Parent Title"
For $n = 1 To $avWinList[0][0]
    $avWinList[$n][2] = _WinAPI_GetParent($avWinList[$n][1])
    $avWinList[$n][3] = WinGetTitle($avWinList[$n][2])
Next
_ArrayDisplay($avWinList, "WinList")

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I don't know of a "GetChildren"...

EnumChildWIndows??


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

EnumChildWIndows??

Sounds like the ticket. I was actually thinking of the _WinAPI_* UDFs (i.e. _WinAPI_EnumWindows). That will take some looking into (for us slower people).

:D

Edit: Hmm... there is a _WinAPI_EnumWindowsChild() internal function. It just doesn't appear to be intended for external use.

Edit2: Well this doesn't work:

#include <WinAPI.au3>
#include <Array.au3>

Global $hParent = WinGetHandle("Spybot - Search & Destroy")
ConsoleWrite("$hParent = " & $hParent & @LF)
_WinAPI_EnumWindowsInit()
_WinAPI_EnumWindowsChild($hParent, False)
_ArrayDisplay($winapi_gaWinList, "$winapi_gaWinList")

The Spybot S&D program has a child window called "Tea Timer" that can be clearly seen in my first script, but is not found by this.

:D

Edit3: Updated demo to create new parent/child windows - still no joy:

#include <WinAPI.au3>
#include <Array.au3>

Global $hParent = GUICreate("Parent", 300, 300, 200, 200)
ConsoleWrite("$hParent = " & $hParent & @LF)
GUISetState()
Global $hChild = GUICreate("Child", 300, 300, 400, 400, Default, Default, $hParent)
ConsoleWrite("$hChild = " & $hChild & @LF)
GUISetState()

Sleep(1000)

_WinAPI_EnumWindowsInit()
_WinAPI_EnumWindowsChild($hParent, False)
_ArrayDisplay($winapi_gaWinList, "$winapi_gaWinList")

Bummer... :D

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0