This function is available from version 2022 R2.

Returns the window in the specified position in the currently tracked window stack.

long ctrx_get_window_id_by_order(int window_order);


The position of the window in the stack. Possible values:

  • 0: Indicates the top-most window.
  • >0: Indicates the window in the specified position relative to the top-most window.
  • -1: Indicates the bottom-most window

Note: This function cannot track child windows.

Return Values

If the function finds the specified window, it returns a unique numeric identifier for the window. If it fails, it returns 0 or E_DISCONNECTED.


The argument window_order can be parameterized.


In the following example, the ctrx_get_window_id_by_order function searches for the second window in the stack (in position 1, under the topmost window). It returns the numeric identifier of the window. The ctrx_get_window_name_by_id function retrieves the name of the window based on the numeric identifier. The lr_log_message function prints a message with the name of the window to the log.

Copy code
char window_name[100];
    ctrx_get_window_name_by_id(ctrx_get_window_id_by_order(1), window_name);     
    lr_log_message("The second window by focus order is: %s", window_name);