cosmin Posted March 9, 2006 Report Share Posted March 9, 2006 Hi, does anyone know how to detect if a VI is stopped througth "abort"? cosmin Quote Link to comment
i2dx Posted March 9, 2006 Report Share Posted March 9, 2006 hmm ... i don't think there is a solution with LV Scripting. Quote Link to comment
Aitor Solar Posted March 9, 2006 Report Share Posted March 9, 2006 Hi,does anyone know how to detect if a VI is stopped througth "abort"? cosmin Ummm. You can program the VI to change the value of some boolean indicator when it finishes normally (well, just the last thing it does before the end). So, if it's aborted, that value would be different. Is that what you were asking? Saludos, Aitor Quote Link to comment
rpursley Posted March 9, 2006 Report Share Posted March 9, 2006 You can monitor the execution state of the vi and react if the vi goes to idle Quote Link to comment
cosmin Posted March 10, 2006 Author Report Share Posted March 10, 2006 You can monitor the execution state of the vi and react if the vi goes to idle I just asked if exist a simple method of detecting abort, if you got a VI that works as process in windows, when you stop the process or windows shutdown, the vi is aborted and any cleanup does not occur. so I had to do cleanup somewhere else and monitoring the state of VI at rapidly to do the cleanup before complete shutdown. cosmin Quote Link to comment
Jeffrey Habets Posted March 10, 2006 Report Share Posted March 10, 2006 I just asked if exist a simple method of detecting abort, if you got a VI that works as process in windows, when you stop the process or windows shutdown, the vi is aborted and any cleanup does not occur. so I had to do cleanup somewhere else and monitoring the state of VI at rapidly to do the cleanup before complete shutdown.cosmin You can use an event structure and catch the Application Exit event. If you use the filter event you can even prevent your app from exiting this way. Quote Link to comment
WMassey Posted March 10, 2006 Report Share Posted March 10, 2006 You can use an event structure and catch the Application Exit event.If you use the filter event you can even prevent your app from exiting this way. Actually I believe he was talking about when someone presses the VI's "Abort Execution" button (the stop sign on the toolbar) and there is no event to capture that. The VI just stops dead in its tracks. It has to work this way to allow people to stop VI's that have infinite loops built into their exit cleanup routines. You can always prevent the user from accessing the abort button however. See here and here for more discussion. The attached VI (LV v7.1.1) is a simple way of trying some of this out. Download File:post-2800-1141994145.zip Quote Link to comment
jpdrolet Posted March 10, 2006 Report Share Posted March 10, 2006 One possibility is to create a CIN and use its CINAbort functionality. From the PDF "Using External Code in LabVIEW": When you abort a VI, LabVIEW calls the CINAbort routine for every reference to a code resource contained in the VI being aborted. Quote Link to comment
cosmin Posted March 13, 2006 Author Report Share Posted March 13, 2006 One possibility is to create a CIN and use its CINAbort functionality. From the PDF "Using External Code in LabVIEW":When you abort a VI, LabVIEW calls the CINAbort routine for every reference to a code resource contained in the VI being aborted. Hi, actually I was talking about the abort that takes place when a user stop a process from services, none of the events works for me (exit, exit?) not even CINAbort . cosmin Quote Link to comment
Jeffrey Habets Posted March 13, 2006 Report Share Posted March 13, 2006 Hi,actually I was talking about the abort that takes place when a user stop a process from services, none of the events works for me (exit, exit?) not even CINAbort . cosmin Hmmm, you're right.. The Exit event only works from the taskmanager's applications tab, not if you kill a process from the processes tab. I guess that's equivalent to unix's kill -9 to unconditionally kill a process. I think that's a good thing btw. There always should be a possibility to unconditionally kill runaway or zombie processes. If you really don't want the user to shutdown your app that way, make sure he doesn't have rights to do that. Don't know much about Windows' user management, but I'm pretty sure a 'normal' user won't be allowed to kill a process that isn't started in the same user's context. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.