ZennoLab Assemblies Documentation
ActiveWindow Method
Example 

Type: System.String !

The header of the window.

Type: System.Boolean

true if need to show the window on top of all; otherwise, false. Default value is false.

Sets the active window.
Syntax
public static string ActiveWindow( 
   string name,
   bool topMost
)

Parameters

name

Type: System.String !

The header of the window.

topMost

Type: System.Boolean

true if need to show the window on top of all; otherwise, false. Default value is false.

Return Value

Type: System.String

The answer with information about the success of the current command's execution. If current command was successful then this answer is "ok"; otherwise message describing the error.

Remarks

There are several ways of calling this method. The parameter topMost have the default value and you can call the method without this parameter. See examples.

This method calls automatically every time when you use methods from ZennoLab.Emulation.

Example
The following code example demonstrates uses of the ActiveWindow method. In this code activated the three windows. The first and the second are shown without parameter topMost (topMost is false). But the third window is shown on top of all.
// activate the first window just show it
string result = Emulator.ActiveWindow("First window");
// if was not any errors 
if (result == "ok" && !Emulator.ErrorDetected)
{
    // also activate the second window just show it but set the parameters topMost == false
    result = Emulator.ActiveWindow("Second window", false);
    // if was not any errors 
    if (result == "ok" && !Emulator.ErrorDetected)
    {
        // also activate the third window and show on top of all. Set the parameters topMost == true
        result = Emulator.ActiveWindow("Third window", true);
        // if all nice
        if (result == "ok" && !Emulator.ErrorDetected) return "All in openwork boss!";
        // if bad
        else return "Fail: The third window";
    }
    else return "Fail: The second window";
}
else return "Fail: The first window";
// activate the first window just show it
$result = ZennoLab\Emulation\Emulator::ActiveWindow("First window");
// if was not any errors 
if ($result == "ok" && !ZennoLab\Emulation\Emulator::ErrorDetected)
{
    // also activate the second window just show it but set the parameters topMost == false
    $result = ZennoLab\Emulation\Emulator::ActiveWindow("Second window", false);
    // if was not any errors 
    if ($result == "ok" && !ZennoLab\Emulation\Emulator::ErrorDetected)
    {
        // also activate the third window and show on top of all. Set the parameters topMost == true
        $result = ZennoLab\Emulation\Emulator::ActiveWindow("Third window", true);
        // if all nice
        if ($result == "ok" && !ZennoLab\Emulation\Emulator::ErrorDetected) return "All in openwork boss!";
        // if bad
        else return "Fail: The third window";
    }
    else return "Fail: The second window";
}
else return "Fail: The first window";
Requirements

Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.

See Also

Reference

Emulator Class
Emulator Members
ButtonClick Method
MouseClick Method
MouseMove Method
ErrorDetected Property
CloseWindow Method

Send Feedback