Tom -
You stated that you want a button on the operator interface to immediately terminate a code module. Keep in mind that the operator interface is running in what I would call the GUI thread, and all executions run in there own threads. In the case of using an external instance of CVI to run code modules, the external instance process has its own threads to execute code modules.
You may already understand this, but if an execution thread is busy running inside a code module, the code module must be told to complete in some way. The only way for this to occur is that the code module must be written to monitor for a state change that signals that it must stop doing its work. If the thread is busy off in some third party code lik
e talking to an instrument, the thread cannot see the state change until the third party code completes.
I am confused about something. You cannot call KillProcess inside the code module unless the code module is actively running code that you have control over. How do you expect the button on the operator interface to instruct the code module to call KillProcess?
Regarding exceptions, you are correct in that CVI does not support structured exception handling. The primary reason is because CVI is C-based and not C++. That is why a code module forces an exception to occur, TestStand will catch it because TestStand internal code supports exception handling. For example if a DLL call using the CVI or DLL adapter causes an access violation, TestStand catches the exception and returns an error as the status for the step call. So if you can force an exception, TestStand will catch it and handle it.
Scott Richardson (NI)
Scott Richardson