viInstallHandler

NI-VISA

viInstallHandler

Purpose

Installs handlers for event callbacks.

C Syntax

ViStatus viInstallHandler(ViSession vi, ViEventType eventType, ViHndlr handler, ViAddr userHandle)

Visual Basic Syntax

N/A

Resource Classes

All I/O session types

Parameters

Name Direction Description

vi

IN

Unique logical identifier to a session.

eventType

IN

Logical event identifier.

handler

IN

Interpreted as a valid reference to a handler to be installed by a client application.

userHandle

IN

A value specified by an application that can be used for identifying handlers uniquely for an event type.

Return Values

Completion Codes Description

VI_SUCCESS

Event handler installed successfully.

 

Error Codes Description

VI_ERROR_INV_OBJECT

The given session reference is invalid.

VI_ERROR_INV_EVENT

Specified eventType is not supported by the resource.

VI_ERROR_INV_HNDLR_REF

The given handler reference is invalid.

VI_ERROR_HNDLR_NINSTALLED

The handler was not installed. This may be returned if an application attempts to install multiple handlers for the same event on the same session.

Description

The viInstallHandler() operation allows applications to install handlers on sessions. The handler specified in the handler parameter is installed along with any previously installed handlers for the specified event. Applications can specify a value in the userHandle parameter that is passed to the handler on its invocation. VISA identifies handlers uniquely using the handler reference and this value.

VISA allows applications to install multiple handlers for an eventType on the same session. You can install multiple handlers through multiple invocations of the viInstallHandler() operation, where each invocation adds to the previous list of handlers. If more than one handler is installed for an eventType, each of the handlers is invoked on every occurrence of the specified event(s). VISA specifies that the handlers are invoked in Last In First Out (LIFO) order.

Related Topics

viEnableEvent

viEventHandler

VISA Resource Template

viUninstallHandler