Share this page

# ctrx_logoff

Information Retrieval Functions

Closes the current session.

`int ctrx_logoff( int force, [CONTINUE_ON_ERROR,] CTRX_LAST );`

force | Use one of the following constants - CTRX_NORMAL_LOGOFF, CTRX_FORCED_LOGOFF or CTRX_FORCED_IF_NORMAL_FAILED, entered as shown without quotes, to specify behavior of the function
CONTINUE_ON_ERROR | A constant, entered without quotes. If CONTINUE_ON_ERROR is passed, the script continues to the next step if the logoff fails.
CTRX_LAST | A marker that indicates the end of the argument list.

ctrx_logoff performs a normal logoff or a forced logoff, depending on the value of the force argument:

- CTRX_NORMAL_LOGOFF — Emulates real user logoff. Unresponsive applications or applications with unsaved data may prevent successful logoff. These applications may display dialog boxes with requests for actions from user, for example, to continue waiting or to close applications.
- CTRX_FORCED_LOGOFF — In this mode, all applications are closed, even if there is unsaved data. The session will be ended, but some data may be lost. CTRX_FORCED_LOGOFF has an effect only if the Citrix Agent is available. If the Agent is not available, ctrx_logoff acts the same as if CTRX_NORMAL_LOGOFF were passed.
- CTRX_FORCED_IF_NORMAL_FAILED — Attempts normal logoff. If logoff fails or times out, logoff is forced.

## Return Values

Citrix ICA Return Values

## Parameterization

Standard parameterization is not available for this function.

## Example

In this example, ctrx_logoff is used to attempt a normal logoff. A forced logoff is attempted if the first attempt fails.

Copy code

    /* Try to perform logoff allowing all
       applications to exit gracefully */
    ctrx_logoff(CTRX_NORMAL_LOGOFF, CONTINUE_ON_ERROR, CTRX_LAST);
    /* If normal logoff timed out, next step executes
       due to CONTINUE_ON_ERROR in previous call.
        Second call forces all apps to close,
        even if they lose data. */
    ctrx_logoff(CTRX_FORCED_LOGOFF, CTRX_LAST);
    ctrx_disconnect_server("", CTRX_LAST);

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