ZennoLab Assemblies Documentation
MouseMove(String,Int32,Int32,Boolean) Method
See Also  Example Send Feedback
ZennoLab.Emulation Assembly > ZennoLab.Emulation Namespace > Emulator Class > MouseMove Method : MouseMove(String,Int32,Int32,Boolean) Method
windowName

Type: System.String

The header of the window.

x

Type: System.Int32

The x coordinate relative to the window.

y

Type: System.Int32

The y coordinate relative to the window.

topMost

Type: System.Boolean

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

Glossary Item Box

Moves the mouse to a specified location in the specified window.

Syntax

C# 
public static string MouseMove( 
   string windowName,
   int x,
   int y,
   bool topMost
)

Parameters

windowName

Type: System.String

The header of the window.

x

Type: System.Int32

The x coordinate relative to the window.

y

Type: System.Int32

The y coordinate relative to 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.

Example

The following code example demonstrates uses of the MouseMove method.
C#Copy Code
// random
Random rnd = new Random();
// x location
int x = 200;
// y location
int y = 200;
// offset X
int offsetX = rnd.Next(100);
// offset y
int offsetY = rnd.Next(100);
// move mouse to start location x = 200 and y = 200 on "Window" window 
string result = Emulator.MouseMove("Window", x, y);
// check result
if (result != "ok" && Emulator.ErrorDetected) return "Fail";
// mouse move to a new location
result = Emulator.MouseMove("Window", x + offsetX, y + offsetY);
// check result
if (result != "ok" && Emulator.ErrorDetected) return "Fail";
// answer
return String.Format("Mouse was moved from x = {0}; y = {1} to x = {2}; y = {3}", x, y, x + offsetX, y + offsetY);
PHPCopy Code
// random
$rnd = new Random();
// x location
$x = 200;
// y location
$y = 200;
// offset X
$offsetX = $rnd->Next(100);
// offset y
$offsetY = $rnd->Next(100);
// move mouse to start location x = 200 and y = 200 on "Window" window
$result = ZennoLab\Emulation\Emulator::MouseMove("Window", $x, $y);
// check result
if ($result != "ok" && ZennoLab\Emulation\Emulator::ErrorDetected) return "Fail";
// mouse move to a new location
$result = ZennoLab\Emulation\Emulator::MouseMove("Window", $x + $offsetX, $y + $offsetY);
// check result
if ($result != "ok" && ZennoLab\Emulation\Emulator::ErrorDetected) return "Fail";
// answer
return String::Format("Mouse was moved from x = {0}; y = {1} to x = {2}; y = {3}", $x, $y, $x + $offsetX, $y + $offsetY);

Requirements

Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2014 All Rights Reserved.