Share this page

# ctrx_get_window_position

Example | Information Retrieval Functions

Retrieves the position of a window.

`int ctrx_get_window_position( LPSTR title, long *xpos, long *ypos, long *width, long *height, [CONTINUE_ON_ERROR,] CTRX_LAST );`

title | The name of the window.
xpos | The horizontal distance of the left edge of the window from the edge of the ICA client window.
ypos | The vertical distance of the top edge of the window from the edge of the ICA client window.
width | The width of the window, in pixels.
height | The height of the window, in pixels.
CONTINUE_ON_ERROR | A constant, entered as shown without quotes. Overrides the error behavior runtime setting for this step so that script behaves as though the runtime setting was Continue on error.
CTRX_LAST | A marker that indicates the end of the argument list. Note: This argument is required.

Use ctrx_get_window_position to retrieve the position of the window with the name title. If title is NULL then the function retrieves the position of the window currently in focus.

Your script creates buffers for xpos, ypos, width, and height and passes the addresses to ctrx_get_window_position. When the function returns, the buffers contain the position data.

## Return Values

Citrix ICA Return Values

## Parameterization

No parameterization is available for this function.

## Example

The following code snippet uses ctrx_get_window_name to retrieve the name of the window currently in focus, and verifies, using strcmp(), that it is the required window. It then calls ctrx_get_window_position to retrieve the window's position and execute a mouse click within it.

    char window_name[100];
    long xpos, ypos, width, height;

    ctrx_mouse_double_click(41, 266, LEFT_BUTTON, 0, NULL, CTRX_LAST);
    ctrx_get_window_name(window_name, CTRX_LAST);

    if (!strcmp(window_name, "Welcome to MSN.com - Microsoft Internet Explorer"))
    {
         ctrx_get_window_position(window_name, &xpos, &ypos, &width, &height, CTRX_LAST);
         ctrx_mouse_click(xpos + 35, ypos +128, LEFT_BUTTON, 0, window_name, CTRX_LAST);
    }

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: