Greetings,
In CVI as in any other C compiler, error handling is done with if-then-else statements, error macros or goto statments. As an example, the following function does error checking and cleanup with a goto statement:
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpszCmdLine, int nCmdShow)
{
if (InitCVIRTE (hInstance, 0, 0) == 0)
return -1; /* out of memory */
SetSleepPolicy(VAL_SLEEP_MORE);
// Load and Display Panel
if ((panelHandle = LoadPanel (0, "OnePanel.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
// Setup critical section
if (SetupApplication() < 0)
goto Error;
// Wait for user input
RunUserInterface ();
Er
ror:
// Terminates the threads if needed
ShutdownApplication();
return 0;
}
To handle the fatal exception you mentioned, you'll need to monitor every return value and jump to a goto statement (emulating a catch statement) whenever the error pops up. You can post your try-catch block if you need additional help.
Regards,
Azucena