CitrixMouseButtonDown Function


Moves the mouse to a specified position and selects a specified button. To release the button, call CitrixMouseButtonUp. Key modifiers (such as Ctrl and Alt) can be provided. Mouse speed can be specified in profile settings (Citrix / Simulation / Mouse) or by an appropriate call to the CitrixSetOption function. The coordinates can be specified absolutely or relatively to a window (by providing a window handle). The top left corner (of the screen or window) has the coordinates 0 / 0.

Include file



CitrixMouseButtonDown( in nX        : number,
                       in nY        : number,
                       in nWindow   : number optional,
                       in nButton   : number optional,
                       in nModifier : number optional ) : boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
nX X coordinate of the position where the button is to be pressed.
nY Y coordinate of the position where the button is to be pressed.
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).

Specify one of the following values (optional):

  • MOUSE_ButtonLeft (default): Left mouse button

  • MOUSE_ButtonRight: Right mouse button

  • MOUSE_ButtonMiddle: Middle mouse button


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


transaction TMain
    CitrixInit(640, 480);
    CitrixConnect("myserver", "myusername", "mypass", "mydomain", COLOR_16bit);
    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);
    CitrixMouseDblClick(41, 23, DESKTOP, MOUSE_ButtonLeft);
    hWnd8 := CitrixWaitForWindowCreation("My Documents", MATCH_Exact, 0x16CF0000, 171, 98, 328, 235);
    CitrixMouseButtonDown(82, 13, hWnd8, MOUSE_ButtonLeft);
    CitrixMouseButtonUp(367, 44, false, DESKTOP, MOUSE_ButtonLeft);
    CitrixWaitForWindowPos(hWnd8,285, 31);
    CitrixMouseClick(317, 13, hWnd8, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd8, EVENT_Destroy);
  end TMain;