viDisableEvent

NI-VISA

viDisableEvent

Purpose

Disables notification of the specified event type(s) via the specified mechanism(s).

C Syntax

ViStatus viDisableEvent(ViSession vi, ViEventType eventType, ViUInt16 mechanism)

Visual Basic Syntax

viDisableEvent&(ByVal vi&, ByVal eventType&, ByVal mechanism%)

Resource Classes

All I/O session types

Parameters

Name Direction Description

vi

IN

Unique logical identifier to a session.

eventType

IN

Logical event identifier.

mechanism

IN

Specifies event handling mechanisms to be disabled. The queuing mechanism is disabled by specifying VI_QUEUE (1), and the callback mechanism is disabled by specifying VI_HNDLR (2) or VI_SUSPEND_HNDLR (4). It is possible to disable both mechanisms simultaneously by specifying VI_ALL_MECH (FFFFh).

Return Values

Completion Codes Description

VI_SUCCESS

Event disabled successfully.

VI_SUCCESS_EVENT_DIS

Specified event is already disabled for at least one of the specified mechanisms.

 

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_MECH

Invalid mechanism specified.

Description

The viDisableEvent() operation disables servicing of an event identified by the eventType parameter for the mechanisms specified in the mechanism parameter. This operation prevents new event occurrences from being added to the queue(s). However, event occurrences already existing in the queue(s) are not flushed. Use viDiscardEvents() if you want to discard events remaining in the queue(s).

Specifying VI_ALL_ENABLED_EVENTS for the eventType parameter allows a session to stop receiving all events. The session can stop receiving queued events by specifying VI_QUEUE. Applications can stop receiving callback events by specifying either VI_HNDLR or VI_SUSPEND_HNDLR. Specifying VI_ALL_MECH disables both the queuing and callback mechanisms.

Note  Calling viDisableEvent() prevents future events from being raised on the given session. When the method returns to the application, it is possible that a callback may still be active, such as on another thread. It is valid for a user to call viDisableEvent() from within a callback, but this is not recommended.

Related Topics

viEnableEvent

VISA Resource Template

viUninstallHandler