From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
LabBEAN

Interrupt or Generate Windows Shutdown

Status: New
There are occasions to interrupt a user generated Windows Shutdown, discard the event, and generate a Windows Shutdown event at a later point (e.g. to allow an acquisition to finish).  This is not always possible within the Event case for Application Instance Close? (e.g. an acquisition is non-deterministic).

Why not add a Windows Shutdown event to the event structure and allow me to discard it?  Can you also write a VI to generate a Windows Shutdown?

According to an NI applications engineer:

"The Application Instance Close? event triggers when LabVIEW application is closing. It does not tell you if Windows is shuting down. The only way to know when Windows is shuting down is to trap the WM_QUERYENDSESSION message that you were talking about yesteray. I have consulted with a R&D engineer to see if there's any way to do this in LabVIEW. The only possible solution we can think of is to write an .NET program that can trap the WM_QUERYENDSESSION message and trigger a event callback that you can register in LabVIEW using "Register Event Callback" VI . None of the engineers I've talked to have done this yet, so I cannot garantee if this will work."

Wouldn't it be more elegant to do this in LabVIEW?

Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
6 Comments
Intaris
Proven Zealot

I'd like to make one change to the above suggestion....

 

Please change the title to "Interrupt or Generate Operating System Shutdown" because this would be useful on Linux and Mac also.

LabBEAN
Active Participant

Too late for me to edit the post... but I'm agreeable if the moderator wants to change the title to:

 

Interrupt or Generate OS Shutdown

 

 


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
JackDunaway
Trusted Enthusiast

Alright, if you're going to start capturing Windows events, go ahead and make an entire toolset of Windows events available to LabVIEW!

Intaris
Proven Zealot

Again, OS Events please!!!!

 

But only those which are cross-platform.  I would not like to see a whole bunch of windows-only functionality in the Event structure......

LabBEAN
Active Participant

Obviously Jack was poking me about suggesting that NI also add an entire Windows events toolset (else, he would have voted for the idea).  But, seriously, if you want to detect a panel close to shutdown your equipment gracefully (e.g. that 600 V power supply), wouldn't you want to trap an OS shutdown for the same reason?


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
JackDunaway
Trusted Enthusiast

>> Obviously Jack was poking me about suggesting that NI also add an entire Windows events toolset (else, he would have voted for the idea).

 

Or he just forgot to vote. Fixed. 😉

 

I'm amenable to more events!