|
Previous Top Next |
Prototype: | (),Long |
Returns | Number of top windows |
This method is used to enumerate all top windows running on the machine. This can come in handy when searching for a window where only part of the caption is known, i.e. "EXCEL" or "WORD". The TopWindows queue contains both the caption in the Text variable and also the upper cased text in the UpperText variable.
Example:
ITW ITWindowsClass
Code
SetupWindow ROUTINE
Data
I Long
Code
If ITW.EnumTopWin()
Loop I = 1 To Records(ITW.TopWindows)
Get(ITW.TopWindows,I)
TopWindows.CW:CwHwnd = ITW.TopWindows.CwHwnd
TopWindows.CW:Style = ITW.TopWindows.Style
TopWindows.CW:ExStyle = ITW.TopWindows.ExStyle
TopWindows.CW:Text = ITW.TopWindows.Text
Add(TopWindows)
End
End
Here is an example that will only load windows based on a search criteria.
ITW ITWindowsClass
Code
FindTopWindows ROUTINE
Data
I Long
FS CString(Size(Loc:Search)+1)
Code
FS = Upper(Clip(Loc:Search))
Free(TopWindows)
If ITW.EnumTopWin()
Loop I = 1 To Records(ITW.TopWindows)
Get(ITW.TopWindows,I)
If Instring(FS,ITW.TopWindows.UpperText,1,1)
TopWindows.CW:CwHwnd = ITW.TopWindows.CwHwnd
TopWindows.CW:Style = ITW.TopWindows.Style
TopWindows.CW:ExStyle = ITW.TopWindows.ExStyle
TopWindows.CW:Text = ITW.TopWindows.Text
Add(TopWindows)
End
End
End
Please refer to the Example Program TestEnumChildWindows procedure for examples of implementation.
See also: