FindWindow Function

Action

Returns a list of window identifiers to all objects that match the specified tag and GUI type.

Syntax

lwWinList = FindWindow([sTag, GuiType])
Variable Description
lwWinList A list of handles to windows declared for currently connected machines, as limited by the optional arguments. LIST OF WINDOW.
sTag

Optional: The full tag hierarchy for a class. When specified, returns a list containing the windows that match sTag. If a window with that tag is not present on the current or specified GUI, FindWindow returns an empty list. If you omit sTag, all windows contained in all declarations used, either explicitly or implicitly, are returned. STRING.

To prevent Silk Test Classic from crashing when using the FindWindow function, use 'tag "{sTag}"' instead of 'tag sTag'.

GuiType Optional: When specified, limits the returned values to those that have a tag that matches sTag and are windows on machines that have the specified GUI type. If you omit sTag, this parameter is ignored. GUITYPE.

Notes

FindWindow works strictly by checking the windows in your declarations; it does not use the Agent to check the windows on the display. To determine which windows are actually open, use the Exist method.

If specified, sTag must be a fully qualified tag. If omitted, you might retrieve more windows than you expect, as FindWindow returns all the windows in all the declarations specified explicitly, in a use statement or in the Runtime Options dialog box, or implicitly. For example, if your script explicitly points to an include file that contains declarations for TestApplication, MessageBox, and xCheckBox, FindWindow called without sTag returns not only these windows but also Agent, Clipboard, Cursor, Desktop, and Taskbar. This behavior occurs because winclass.inc is implicitly pulled in, and this file has declarations for these other windows.

FindWindow does not work with multitags.

FindWindow() is not able to find window declarations using dynamic tags.

Example

LIST OF WINDOW lwWinList
// Get handles to all mswnt "Find" windows
lwWinList = FindWindow("/[MainWin]TextEditor/[DialogBox]Find", mswnt)