This function is available from version 2022 R2.

Activates the window specified by a given ID.

int ctrx_activate_window_by_id(long window_id);


A unique window ID, returned by a function such as ctrx_get_window_id_by_order.

Return Values

If the function succeeds, it returns E_OK. Otherwise, it returns E_GENERAL_ERROR or E_DISCONNECTED.


Parameterization is not available for this function.


In the following example, the ctrx_find_window_by_name function searches for a window with the name "New Tab - Google Chrome." If it finds a window with a matching name, it returns the numeric identifier of the window. The ctrx_activate_window_by_id function uses the numeric identifier to find the window and activate it.

ctrx_activate_window_by_id(ctrx_find_window_by_name("New Tab - Google Chrome", MATCH_Exact));