InstallCustomEventHandler Method

NI-VisaNS .NET Class Library Help for Visual Studio 2010

Edition Date: August 2012

Part Number: 370627F-01

»View Product Info
Download Help (Windows Only)

Session Class See Also


Installs a handler for a nonstandard or new event type.

Namespace: NationalInstruments.VisaNS

Assembly: NationalInstruments.VisaNS (in NationalInstruments.VisaNS.dll) Version: 13.0.40.167

Syntax

Visual Basic (Declaration)
Public Sub InstallCustomEventHandler ( _
	customEventType As Integer, _
	handler As VisaEventHandler _
)

C#
public void InstallCustomEventHandler(
	int customEventType,
	VisaEventHandler handler
)

Parameters

customEventType
Type: System.Int32
Custom logical event identifier.
handler
Type: NationalInstruments.VisaNS.VisaEventHandler
VisaEventHandler that receives the custom event.

Exceptions

ExceptionCondition
VisaException The NI-VISA driver returned an error as a result of calling this method.
ArgumentException

The customEventType is not recognized by the driver.

-or-

The handler delegate is invalid.

DllNotFoundException The NI-VISA driver library cannot be found.
EntryPointNotFoundException A required operation in the NI-VISA driver library cannot be found.
ObjectDisposedException This member is called after the Dispose method is called directly from code or indirectly through a finalizer.

Remarks

This method is provided only for extensibility. You should use this method if the event type that you are looking for does not appear on the API.

Use this method to receive nonstandard or new events that are not a part of this API. This method installs a handler for customEventType, and when the event occurs, the method that handler points to is executed. You can install more than one handler for the same custom event type. You can also install handlers for multiple custom event types.

Note: In some cases, callbacks and event handlers are executed in a different thread than the rest of the program. Therefore, you must take special care when accessing objects that have thread affinity, such as UI controls, from these callbacks and event handlers. For more information, refer to Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries.

See Also

Reference

Session Class

NationalInstruments.VisaNS Namespace

Other Resources

WAS THIS ARTICLE HELPFUL?

Not Helpful