LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Catch windows standby / suspend event

Dear NI "family"

 

I'm doing a real time application using USB hardware, and would very much like to do a graceful exit from my program should  the user suddenly suspend or standby the computer (despite that the manual shipped with the program kindly asks to disable said features, but we all know how many actually reads these papers:-))

 

So - is there a way, maybe in the event structure, to catch windows going into suspend or standby? I'm using the "application instance close" event to detect a push on the powerbutton, but this only goes for a total shutdown of windows.

 

Anyone who knows how to deal with this..

 

Thank you in advance.

 

Jacob Navne

using LV8.6 full version 

0 Kudos
Message 1 of 5
(4,982 Views)

Hi.

 

You'll need to catch the Windows message PBT_APMSUSPEND, which is broadcast 2 seconds before the the computer enters sleep (see this MSDN article).  Use this LabVIEW library for that.

 

Note that it might not work unless you're running LabVIEW as an actual .exe file; I don't think it will work in the development environment.

 

Jeremy

0 Kudos
Message 2 of 5
(4,959 Views)

Hi Jeremy

 

Thank you for your reply.. I can't really check it out as the link does not appear to work.. do you have some keywords that I can use for searching at the MSDN page. Also - being a LV8.6 user - the library link does no good for me, as LV5 files will not open in the new LabVIEW versions - can you, or some other merceful soul in this forum, convert the files to a more recent version of LabVIEW.

 

As always, thank you in advance.

 

Best regards 

Jacob 

0 Kudos
Message 3 of 5
(4,934 Views)

Sorry, that was my fault with the MSDN link.  See http://msdn.microsoft.com/en-us/library/ms703398(VS.85).aspx; the article is titled "The Power-Aware Application" if that link doesn't work.  As for the message queue version issue, try the one on this post: http://forums.ni.com/ni/board/message?board.id=170&message.id=284239#M284239

 

Jeremy

Message 4 of 5
(4,931 Views)

Brilliant Jeremy.. Thank you very much for your help.. This way of combining Windows with LV is new to me, so further studies from my part are required, but it looks like this is all the information that I will need. 

 

Thank you!

 

best regards

Jacob

 

0 Kudos
Message 5 of 5
(4,921 Views)