Open topic with navigation
|Example||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 run-time setting for this step so that script behaves as though the run-time 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.
No parameterization is available for this function.
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.
long xpos, ypos, width, height;
ctrx_mouse_double_click(41, 266, LEFT_BUTTON, 0, NULL, 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);