LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

avoid task kill closing exe

Hi,

 

is there a way to avoid that an exe can be closed via the windows task manager?

 

I´ve tried the "Application Instance Close?" Event but this does not work.

 

I need to show a dialog to the user when my LabVIEW application wants to be closed from the Task Manager.

0 Kudos
Message 1 of 7
(3,450 Views)

There's no way to do this from labview, windows will just abort/kill your application if you close if from task manager, it doesn't care about you trying to process events in labview.

Like if you pull the plug from your computer, but want a dialog box to appear in windows asking if you really want to shut it down.

 

The application instance close will handle you using the X button in the top right to close the application main window.

 

Make sure your program handles window closes if you need to do anything before shutdown (such as restoring hardware to safe states).

 

Unfortunately if you end user wants to kill it with task manager, you can't do much about it.

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 2 of 7
(3,436 Views)

Hi,

 

thanks for your post.

 

But the "Application Instance Close?" Event does not handle pressing the "X" on the Front Panel. Also it does not handle the right click on the task bar application icon and selecting "close window".

 

For this the "Panel Close" Event is the one that is executed.

The only way i see the "Application Instance Close" event is, when closing the Application with Ctrl + Q.

 

regards,

 

Daniel

0 Kudos
Message 3 of 7
(3,432 Views)

Yes I checked and misunderstood a bit.

 

You are right, the application instance close is fired when you basically execute the quit labview/quite application command from the menu as you say.

 

It was the panel close I was thinking of for the X button.

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 4 of 7
(3,425 Views)

Hello Again,

 

when closing an application from the task manager there are two different ways.

 

1. Killing the process:

--> Task Manager - Processes Tab - End Process

 

2. Closing the Task

--> Task Manager - Applications Tab - End Task

 

Killing the process can not be avoided, but closing the task should generate an event that can be catched i think.

0 Kudos
Message 5 of 7
(3,414 Views)

You could consider some workarounds:

- Run your Labview .exe as a Windows service (http://digital.ni.com/public.nsf/allkb/21BA0F671A63A60386256CB4004DF99B?OpenDocument). Of course if your user is the pc admin, then this is useless.

- Keep a second process monitorig the status of the exe and restarting it if it's closed

- Hide the exe from Task Manager (...but i'm afraid this is not possible...)

 

Marco

0 Kudos
Message 6 of 7
(3,408 Views)

I also had this idea, but when the application was closed its already too late.

In other programming languages i thought it is possible to receive an event when the task has to be closed.

0 Kudos
Message 7 of 7
(3,400 Views)