Share this page

# ctrx_get_window_name

Information Retrieval Functions

Retrieves the name of the active window.

`int ctrx_get_window_name( LPSTR buffer, [CONTINUE_ON_ERROR,] CTRX_LAST );`

buffer | The output parameter containing the name of the window
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.

Use ctrx_get_window_name to retrieve the title of the window currently in focus.

It is up to the user to allocate memory space for buffer before ctrx_get_window_name is invoked and to de-allocate the memory when no longer in use.

## Return Values

Citrix ICA Return Values

## Parameterization

No parameterization is available for this function.

## Example

The following code snippet invokes 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 executes a mouse click within the window.

Copy code

    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-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: