LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with detecting Windows Shutdown in LV 7.1/8.2

I am trying to intercept a windows shutdown (possibly initiated from a UPS device) to shut down a LV app delicately.  I have tried these in both 7.1 and 8.2 on XP.

For several reasons (having nothing to do with what I am posting here) I will be using a different method to solve my actual problem, but I wanted to post this info here so the AEs can take a look at it (I posted to Info-Labview and was eventually given that advice).

I have a attached a test VI that demonstrates problems I am having with using both the Event structure and a Windows Message Queue library posted here on Devzone.  All windows shutdowns are initiated through the start menu for this testing.

Observations:
1) If I DO NOT register for WindowsMessage 0x11 (WM_QUERYENDSESSION), the Event structure will recognize the Query event and allow me to Discard/non-Discard. This seems to be proper LV behavior.

2) The WM Queue VIs never receive the 0x11 message.  It seems that something in LV catches the WM_QUERYENDSESSION message before it gets to the Windows Message Queue VIs.  So you never actually receive message 0x11, under any circumstances that I have tried.  (The same VIs work correctly with other types of messages).

3) I have noticed that if I have both the Windows Message Queue registered for 0x11 AND an event structure waiting for the "Application Exit?" event, the Event structure will not detect the shutdown, and windows will eventually bring up the End Now message.
0 Kudos
Message 1 of 1
(2,269 Views)