GetParent Function

Class

AnyWin class.

Action

Returns the parent of the window.

Syntax

wParentWin = window.GetParent()
Variable Description
wParentWin The parent of the window. WINDOW.

Example

The following code sample gets the parent window of a message box:
WINDOW wParent = MessageBox.GetParent()

To get the caption and the window class name of the parent window, you can use the following code:

STRING sParentCaption = wParent.GetProperty("caption").ToString()
STRING sParentClassName = wParent.GetProperty("windowClassName").ToString()

Notes

  • If you call this function on the DesktopWin class, Silk Test Classic raises an exception.
  • Backward compatibility: In previous releases, GetParent returned a window tag instead of an object-oriented identifier. Use the OPT_REL1_CLASS_LIBRARY option to specify use of the pre-Release 2 version of this method.