Handling Events in a LabWindows/CVI User Interface
- Updated2025-07-23
- 1 minute(s) read
To handle an event in LabWindows/CVI, you register a callback function, which LabWindows/CVI automatically calls when the control generates the event. Use the Event Callback Registration functions in the TestStand User Interface (UI) Controls driver to perform event registration.
For example, the following statement registers a callback function for the OnExitApplication event sent from the Application Manager control:
TSUI__ApplicationMgrEventsRegOnExitApplication (gAppMgrHandle, AppMgr_OnExitApp, NULL, 1, NULL);
The callback function can contain the following code, which verifies whether the TestStand Engine
is in a state where it can shut
down:
HRESULT CVICALLBACK AppMgr_OnExitApp(CAObjHandle caServerObjHandle, void *caCallbackData)
{
VBOOL canExitNow;
if (!TSUI_ApplicationMgrShutdown(gAppMgrHandle, &errorInfo, &canExitNow) && (canExitNow))
QuitUserInterface(0);
return S_OK;
}