ctrx_execute_on_window_destroy

ExampleGeneral Functions

Specifies handler function when window is closed (destroyed).

void ctrx_execute_on_window_destroy( char *window_name, long handler );

window_nameThe name of the window that initiates the handler.
handlerThe function to invoke when the window is closed.

ctrx_execute_on_window_destroy specifies the function to call when a window is closed (destroyed). When a window with the name window_name is closed, the handler function is invoked.

The asterisk wildcard character (*) can be used in window_name.

Put the actions you wish to perform in the handler function, which must have the following prototype:

int handler( char *title);

The name of the window is passed to the handler as title argument.

Note:  

  • We recommend including a think time after the handler function is invoked, especially if it is invoked at the end of the Actions section of a Vuser script. If the handler function is invoked at the end of the Actions section and is not followed by a think time, the vuser_end logoff procedure may be executed before the handler function is completed.
  • The lr_rendezvous function is not supported when a ctrx_execute_on_window_activation function is pending.

Return Values

This function has no return value.

Parameterization

No parameterization is available for this function.

Example

In this example a log message is written when the "Untitled - Notepad" window is closed.

Copy code
int callbackf_win_destroy(char *title)
{
    lr_log_message("The following window was closed: %s", title);
    return 0;
}

Action()
{
    ctrx_execute_on_window_destroy ("Untitled - Notepad" , callbackf_win_destroy);

}