ActiveWindow (Desktop Objects)

Applies to TestComplete 15.63, last modified on April 23, 2024

Description

Use the method to get the current top-level window (the window the user is currently working with) as a reference to the Window object.

Declaration

TestObj.ActiveWindow()

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Result A Window object.

Applies To

The method is applied to the following object:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Result Value

The Window object that represents the current top-level window. If no top-level window is found, the ActiveWindow method returns an empty stub object.

Example

The following example demonstrates how to use the ActiveWindow method in scripts:

JavaScript, JScript

var w = Sys.Desktop.ActiveWindow();
w.Minimize();
w.Restore();

Python

w = Sys.Desktop.ActiveWindow();
w.Minimize()
w.Restore()

VBScript

Set w = Sys.Desktop.ActiveWindow
w.Minimize
w.Restore

DelphiScript

var w;
begin
  w := Sys.Desktop.ActiveWindow;
  w.Minimize;
  w.Restore;
end;

C++Script, C#Script

var w = Sys["Desktop"]["ActiveWindow"]();
w["Minimize"]();
w["Restore"]();

See Also

Window Object
FocusedWindow Method (Desktop Objects)

Highlight search results