microwaved Posted March 22, 2005 Report Share Posted March 22, 2005 I need to detect that the user logged out of Windows so I can exit my program gracefully. The ni site said there were Windows Event Queue vi's that could be used to catch the WM_QUERYENDSESSION message, but I haven't been able to find them. Maybe there is a better way to do this? Quote Link to comment
FLX Posted March 22, 2005 Report Share Posted March 22, 2005 Hi, if you search with google for "Windows Message Queue Library LabVIEW". You should come to this link. Windows Message Queue Library In the readme you find the message numbers, too. #define WM_QUERYENDSESSION 0x0011 good luck :thumbup: alex Quote Link to comment
jed Posted September 12, 2007 Report Share Posted September 12, 2007 I would love to do this, but I need to delay the shutdown: Any idea how to delay it until I am done with some housekeeping? Or can I figure out exactly what the shutdown params are (shutdown/restart/etc), then cancel it, do my thing and reinitiate it? Quote Link to comment
AdamRofer Posted September 13, 2007 Report Share Posted September 13, 2007 QUOTE(jed @ Sep 11 2007, 01:26 PM) I would love to do this, but I need to delay the shutdown:Any idea how to delay it until I am done with some housekeeping? Or can I figure out exactly what the shutdown params are (shutdown/restart/etc), then cancel it, do my thing and reinitiate it? I keep a shortcut on my desktop to "C:\WINDOWS\system32\shutdown.exe -a" which aborts any shutdowns that I notice quickly enough. I'm sure a Windows DLL alternative is out there but calling this should work as well. Quote Link to comment
Rolf Kalbermatter Posted September 13, 2007 Report Share Posted September 13, 2007 QUOTE(jed @ Sep 11 2007, 04:26 PM) I would love to do this, but I need to delay the shutdown:Any idea how to delay it until I am done with some housekeeping? Or can I figure out exactly what the shutdown params are (shutdown/restart/etc), then cancel it, do my thing and reinitiate it? The Windows message queue example is not really meant to hook directly into the queue but only monitor it. In order to hook into that event you would have to modify the C source code of that example to do that specifically. Not to difficult but without some good C knowledge not advisable. Another way might be that newer LabVIEW versions will send a filter event in the event handling structure "Application Instance Close?" which you can use to disallow shutting down the app. Not sure if it will disallow shutting down the session directly though. But it should be enough to detect that there might be a shutdown in progress and allow you to execute the command Adam mentioned to abort that. Rolf Kalbermatter 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.