CitrixMouseMove Function

Action

Moves the mouse to a specified position. This function does not change the button state. Therefore it can be used to move the mouse between a call to CitrixMouseButtonDown or CitrixMouseButtonUp. Key modifiers (such as Ctrl and Alt) can be provided. Mouse speed can be specified by profile settings (Citrix / Simulation / Mouse) or by an appropriate call to the CitrixSetOption function. The position can be specified absolutely, or relatively to a window (by providing a window handle) or the last mouse position (by setting the bRelative parameter to true).

The top left corner (of the screen or window) has the coordinates 0 / 0.

Include file

CitrixAPI.bdh

Syntax

CitrixMouseMove( in nX        : number,
                 in nY        : number,
                 in bRelative : boolean optional,
                 in nWindow   : number optional,
                 in nModifier : number optional ) : boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
nX X coordinate of the new mouse position (relative to the provided window or the entire desktop). When the bRelative parameter is set to true, the new mouse position is calculated by adding the specified X value to the current mouse position.
nY Y coordinate of the new mouse position (relative to the provided window or the entire desktop). When the bRelative parameter is set to true, the new mouse position is calculated by adding the specified Y value to the current mouse position.
bRelative Specify this parameter to calculate the new mouse position by adding the provided vector (nX, nY) to the current mouse position (optional). When this parameter is omitted, the nWindow parameter dictates how the new mouse position is calculated.
nWindow Window handle returned by a call to CitrixWaitForWindowCreation (optional). When this parameter is omitted or DESKTOP is specified, the provided coordinates must be relative to the desktop. When a window handle is specified, the nX and nY parameters state a position relative to the top left corner of the window (wherever the window is on the desktop).

When the bRelative parameter is set to true, this parameter is ignored.

nModifier

Specify one of the following values (optional):

  • MOD_None (default): No modifier

  • MOD_Shift: Shift key pressed in combination with the mouse button

  • MOD_Ctrl: Ctrl key pressed in combination with the mouse button

  • MOD_Alt: Alt key pressed in combination with the mouse button

Example:

transaction TMain
  var
  begin
    CitrixInit(640, 480);
    CitrixConnect("myserver", "myusername", "mypass", "mydomain", COLOR_16bit);
    CitrixWaitForLogon();
    hWnd6 := CitrixWaitForWindowCreation("ICA Seamless Host Agent", MATCH_Exact, 0x94C800C4, 0, 0, 390, 223);
    CitrixWaitForWindow(hWnd6, EVENT_Activate);
    CitrixWaitForWindowCreation("Program Manager");
    CitrixMouseClick(211, 197, hWnd6, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd6, EVENT_Destroy);
    ThinkTime(4.48);
    CitrixMouseClick(41, 13, hWnd4, MOUSE_ButtonLeft);
    hWnd8 := CitrixWaitForWindowCreation("", MATCH_Exact, 0x96400000, 2, 193, 163, 263);
    CitrixMouseMove(76, 117, false, hWnd8);
    hWnd8 := CitrixWaitForWindowCreation("My Documents", MATCH_Exact, 0x16CF0000, 171, 98, 328, 235);
    CitrixWaitForWindow(hWnd8, EVENT_Activate);
    CitrixMouseButtonDown(82, 13, hWnd8, MOUSE_ButtonLeft);
    CitrixMouseButtonUp(367, 44, false, DESKTOP, MOUSE_ButtonLeft);
    CitrixWaitForWindowPos(hWnd8, 285, 31);
    ThinkTime(5.41);
    CitrixMouseClick(317, 13, hWnd8, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd8, EVENT_Destroy);
    CitrixDisconnect();
  end TMain;