Description
The GetWindowsList function returns the list of parent window names present on the Windows desktop. This function is not available in WinTask Lite.
Syntax
GetWindowsList(<tab_namewin$>, <tab_instanc>, <tab_handl>, <tab_flag$>)
or
Ret = GetWindowsList(<tab_namewin$>, <tab_instanc>, <tab_handl>, <tab_flag$>)
Parameters
<tab_namewin$>: alphanumeric array; lists the names of the parent windows present on the desktop. These names use the syntax described in theUseWindowstatement.<tab_instanc>: integer array; lists the instance numbers of each parent window present on the desktop.<tab_handl>: integer array; lists the handle of each parent window present on the desktop.<tab_flag$>: alphanumeric array; two characters containing the status of the application or of the window. The first character is 1 if the status is “running”, 0 if not. The second character is 1 if the application is enabled (it can receive actions), 0 if disabled.
Return Value
Ret: integer, return code which gives the number of found windows. If any of the arrays is too small, Ret contains -1, but the arrays will still contain the first n windows found (if #IgnoreErrors=1). If Ret=-1 and #IgnoreErrors=0, the script is stopped.
Example
'Declare the arrays used by GetWindowsList
Dim namewin$(210)
Dim numinst(210)
Dim handlewin(210)
Dim winflag$(210)
proc$ = "namewin.txt"
create(proc$)
p = GetWindowsList(namewin$(), numinst(), handlewin(), winflag$())
' Check for errors
If p = -1 Then
MsgBox("Error: Arrays too small or another error occurred.")
Else
write(proc$, str$(p), CRLF)
i = 0
repeat
' The list is written to the file
write(proc$, namewin$(i) + "," + str$(numinst(i)) + "," + str$(handlewin(i)) + "," + winflag$(i), CRLF)
i = i + 1
until i = p
pause 1
' The list is displayed
shell("notepad " + proc$)
End If
See Also
See the script example, Close all Internet Explorer windows.
