Share this page

# ctrx_find_window_by_name

Example

Searches all tracked windows for a window with the specified caption (name).

`long ctrx_find_window_by_name( char *Caption, long Match );`

Caption | Name of the window to search for.
Match | The search option that defines the type of search. Possible values: MATCH_Exact: Case-sensitive comparison. MATCH_ExactNoCase: Case-insensitive comparison. MATCH_Wildcard: The search string must either begin or end with a '*' character, which matches everything. The rest of the string is compared case sensitively. MATCH_WildcardNoCase: The search string must either begin or end with a '*' character, which matches everything. The rest of the string is compared case insensitively. MATCH_RegExp: The search string is a regular expression.

A window is specified by its caption (name), and one of five different search options can be selected using the Match parameter. If the function succeeds, it returns a unique window identifier that can be used as the window_id parameter in other Citrix functions.

## Return Values

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

## Parameterization

The argument Caption can be parameterized.

## Example

In the following example, the ctrx_find_window_by_name function searches for a window with the name "Microsoft Edge" using case-sensitive comparison. It returns the numeric identifier of the window. The lr_log_message function prints the identifier to the log.

Copy code

    lr_log_message("window identifier: %d", ctrx_find_window_by_name("Microsoft Edge", MATCH_Exact));

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