# User Callback

The User Callback function is called as an argument of the cbEnableEvent() function. You create the function using the prototype shown below. You call the function by passing either it's address or a pointer to the function to the CallbackFunc argument of the cbEnableEvent() function.

## Callback function prototype

C/C++

void __stdcall CallbackFunc(int BoardNum, unsigned EventType, unsigned EventData, void* UserData);

Visual Basic

Sub CallbackFunc(ByVal BoardNum&, ByVal EventType&, ByVal EventData&, ByRef UserData as UserDataType)

where UserDataType is the data type of the UserData argument passed to cbEnableEvent().

## Arguments

BoardNum

Indicates which board caused the event.

EventType

Indicates which event occurred.

EventData

Board-specific data associated with this event. Returns the value of the EventType as listed in the "EventData argument values" section below.

UserData

The pointer or reference to data supplied by the UserData parameter in cbEnableEvent(). Note that before use, this parameter must be cast to the same data type as passed in to cbEnableEvent().

### EventData argument values

EventType | Value of EventData
ON_DATA_AVAILABLE | The number of samples acquired since the start of the scan.
ON_END_OF_INPUT_SCAN | The total number of samples acquired upon the scan completion or end.
ON_END_OF_OUTPUT_SCAN | The total number of samples output upon the scan completion or end.
ON_EXTERNAL_INTERRUPT | The number of interrupts generated since enabling the ON_EXTERNAL_INTERRUPT event.
ON_PRETRIGGER | The number of pretrigger samples available at the time of pretrigger. This value is invalid for some boards when a TOOFEW error occurs. Refer to board details.
ON_SCAN_ERROR | The error code of the scan error.