
56
Agilent VISA User’s Guide
3
Programming with VISA
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
.
Example: Installing an Event Handler
This example 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
);
Use the
viUninstallHandler
function to uninstall a specific handler, or
you can use wildcards (VI_ANY_HNDLR in the
handler
parameter) to
uninstall groups of handlers. See
viUninstallHandler
in the
VISA
Online Help
for more details on this function.
Writing the Handler
The
handler
installed needs to be written by the programmer. The event
handler typically reads an associated attribute and performs some sort of
action. See the event handler in the example program later in this
section.
Enabling Events
Before an event can be delivered, it must be enabled using the
viEnableEvent
function. This function causes the application to be
notified when the enabled event has occurred, where the parameters are:
viEnableEvent(
vi
,
eventType
,
mechanism
,
context
);
Содержание E2094S
Страница 6: ...6 Agilent VISA User s Guide ...
Страница 116: ...116 Agilent VISA User s Guide 4 Programming via GPIB and VXI ...
Страница 126: ...126 Agilent VISA User s Guide 5 Programming via LAN ...
Страница 143: ...Glossary Agilent VISA User s Guide 143 Windows notification area See notification area ...
Страница 144: ...144 Agilent VISA User s Guide Glossary ...