imaqSetEventCallback
Usage
int imaqSetEventCallback(EventCallback callback, int synchronous);
Purpose
Sets a callback function that NI Vision calls when an event occurs in a window. When a user generates an event, NI Vision calls the callback function using the following parameters: event, window number, tool, and location of the event. For a full description of these parameters, refer to imaqGetLastEvent().
Parameters
Name
|
Type
|
Description
|
---|---|---|
callback | EventCallback | The function to call. Set this parameter to NULL if you want to disable event processing using a callback. If you disable callbacks, you can process events using imaqGetLastEvent(). |
synchronous | int | Set this parameter to TRUE to call the callback function in the thread that calls imaqSetEventCallback(). Set this parameter to FALSE to call the callback function asynchronously in a separate thread. To process callbacks synchronously, your application must have a message pump. In LabWindows/CVI, calling RunUserInterface() starts a message pump. The function ignores this parameter if callback is NULL. |
Return Value
Type |
Description |
---|---|
int | On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError(). |
Parameter Discussion
callback—callback should have the following prototype: void IMAQ_CALLBACK MyCallback(WindowEventType, int windowNumber, Tool tool, Rect rect);