User`s guide

Programming with VISA 3
Agilent VISA User’s Guide 67
viInstallHandler(vi, eventType, handler,
userHandle);
These parameters are defined as follows.
The userHandle parameter allows you to assign a value to
be used with the handler on the specified session. Thus, you
can install the same handler for the same event type on
several sessions with different userHandle values. The same
handler is called for the specified event type.
However, the value passed to userHandle is different.
Therefore the handlers are uniquely identified by the
combination of the handler and the userHandle. This may
be useful when you need a different handling method
depending on the userHandle.
Sample: Installing an Event Handler
This sample shows how to install an event handler to call
my_handler when a Service Request occurs. Note that
VI_EVENT_SERVICE_REQ must also be an enabled event
with the viEnableEvent function for the service request
event to be delivered.
viInstallHandler(vi, VI_EVENT_SERVICE_REQ,
my_handler, addr);
Table 21 Parameters Used to Install a Handler
Parameter Description
vi The session on which the handler will be installed.
eventType The event type that will activate the handler.
handler The name of the handler to be called.
userHandle A user value that uniquely identifies the handler for the
specified event type.