Sets the active window.
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.
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";
Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.