LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I cancel a runing program by software?

Hi,

i have to stop a LabView-DAQ-program from running on a w2k PC by software.

I'm looking for a program, which can stop the DAQ-program from execution
if the UPS signals a system shutdown (power failure).
The UPS software can execute any program or .cmd-file before it shuts
off system power.

Any ideas?

Thanks in advance

Jörg
0 Kudos
Message 1 of 6
(3,026 Views)
Hi joemm

Try using shutdown command -f option ( to force applications to close)
More info about that in this link:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/shutdown.mspx
It is XP but probably the command is the same for w2k

Hope it helps.
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 2 of 6
(3,026 Views)
The command "kill LabVIEW" will kill any Labview program that is running. To try it, open a labview program, bring up the command prompt window, and type in the command. Labview is gone. However, this is not an orderly shutdown of your Labview program. To do that, your vi would have to monitor the signal from the UPS and execute an orderly shutdown if it detects a power failure signal. I don't know how to monitor the UPS from Labview but maybe someone else does.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 6
(3,026 Views)
Also see this thread:

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5
0650000000800000040EA0000&USEARCHCONTEXT_CATEGORY_0=_49_%24_6_&USEARCHCONTEX
T_CATEGORY_S=0&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&UPostedFromTimeSearchArg
_0=3&UPostedFromTimeSearchArg_1=3&UPostedFromTimeSearchArg_2=2004&UPostedFro
mTimeSearchArg_S=4&UPostedToTimeSearchArg_0=30&UPostedToTimeSearchArg_1=8&UP
ostedToTimeSearchArg_2=2004&UPostedToTimeSearchArg_S=4&USEARCHCONTEXT_TIER_0
=2&USEARCHCONTEXT_TIER_S=0&USEARCHCONTEXT_QUESTION_0=power&USEARCHCONTEXT_QU
ESTION_S=0


"joemm" wrote in message news:cgvkkj$nt2$2@online.de...
> Hi,
>
> i have to stop a LabView-DAQ-program from running on a w2k PC by software.
>
> I'm looking for a program, which can stop the DA
Q-program from execution
> if the UPS signals a system shutdown (power failure).
> The UPS software can execute any program or .cmd-file before it shuts
> off system power.
>
> Any ideas?
>
> Thanks in advance
>
> Jörg
0 Kudos
Message 4 of 6
(3,026 Views)
Hi,

tbob schrieb:
> The command "kill LabVIEW" will kill any Labview program that is
> running.

Thanks for this hint. It works.
But I hope there will be another solution, which is not so rigid.

I have to terminate some internal operations in my LabVIEW programm
fully controlled. A hard process kill will cause some problems after
restart.

I will test a 'virtual state variable' (entry in a special file,
registry entry, or what other?) inside a slow timed loop to monitor
power state. Than the UPS software can call a small programm or
..cmd-file to switch this 'State variable'.

What think you abaut this?
Any other ideas?

Thanks in advance

Jörg
0 Kudos
Message 5 of 6
(3,026 Views)
You could create an empty file (with Notepad or anything) when you start your Labview program. Create a command file for the UPS to execute that contains the "delete " command. Have your Labview program periodically check for the file's existence. If not there, then begin orderly shutdown. You could create a registry key in Labview and read it periodically, but I'm not sure how to change the key from a command line for the UPS to execute. Maybe the regedit command has some command line arguments that would allow changing a key. I believe it does but I don't know the syntax. This could be a valuable tool if someone else here knows how to manipulate the registry from a command line.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 6
(3,026 Views)