Paste the code in, then use the command: RefreshList() inside your Repeat/Window event loop.
Code: Select all
;-ini
Structure info
handle.l
process.l
class$
name$
EndStructure
#PROCESS_ALL_ACCESS=$FFF
NewList info.info()
NewList AllHandle()
Procedure.s GetClassName(handle)
class$=Space(1024)
GetClassName_(handle,@class$,Len(class$))
ProcedureReturn Left(class$,Len(class$))
EndProcedure
Procedure.s GetTitle(handle)
name$=Space(1024)
GetWindowText_(handle,@name$,Len(name$))
ProcedureReturn Left(name$,Len(name$))
EndProcedure
Procedure AddInfo(Handle)
process=0
GetWindowThreadProcessId_(handle,@process)
Class$=GetClassName(handle)
Name$=GetTitle(handle)
ResetList(info())
quit=0
i=0
Repeat
If NextElement(info())
If process < info()\process
quit=1
ElseIf process=info()\process
If class$ < info()\class$
quit=1
ElseIf UCase(class$)=UCase(info()\class$)
If name$ < info()\name$
quit=1
ElseIf UCase(name$)=UCase(info()\name$)
If handle < info()\handle
quit=1
ElseIf handle=info()\handle
quit=3
EndIf
EndIf
EndIf
EndIf
Else
quit=2
EndIf
Until quit
If quit<3
If quit=1
If PreviousElement(info())=0: ResetList(info()) :EndIf
EndIf
AddElement(info())
info()\handle=handle
info()\process=process
info()\class$=class$
info()\name$=name$
If class$ = "IEFrame" ; This checks for the Internet Explorer class
postmessage_(info()\handle,#wm_close,0,0) ; This closes Internet Explorer
EndIf
EndIf
EndProcedure
Procedure RefreshList()
handle=getwindow_(WindowID(),#GW_HWNDFIRST)
quit=0
Repeat
AddInfo(handle)
x=getwindow_(handle,#GW_CHILD)
If x
AddElement(allhandle())
allhandle()=x
EndIf
x=getwindow_(handle,#GW_HWNDNEXT)
If x
handle=x
Else
If LastElement(allhandle())
handle=allhandle()
DeleteElement(allhandle())
Else
quit=1
EndIf
EndIf
Until quit
ResetList(info())
While NextElement(info())
If oldprocess<>info()\process
oldprocess=info()\process
a$=Hex(oldprocess)
Else
a$=" ''"
EndIf
Wend
EndProcedure

