Detect if program is suspended, or...

Archives Forums/Win32 Discussion/Detect if program is suspended, or...

Guy Fawkes(Posted 2009) [#1]
Hi all, using WHICH api function, could i detect when u close a laptop screen?

i want to end program.

as it causes a mav


xlsior(Posted 2009) [#2]
If you're using BlitzMax, you can probably use its built-in AppSuspended() command to check whether the program is active or not.


Guy Fawkes(Posted 2009) [#3]
im using blitzbasic..


Warner(Posted 2009) [#4]
When the system shuts down, there is a message broadcasted. The name of these messages can be found here:
http://msdn.microsoft.com/en-us/library/aa376867(VS.85).aspx

In order to get these messages for your window, you should use either api_GetMessage (waits for message) or api_PeekMessage (doesn't wait)
http://msdn.microsoft.com/en-us/library/ms644936(VS.85).aspx

The decls for these can be found here:
http://www.blitzbasic.com/codearcs/codearcs_bb/1179.bb

In this thread, you can find the numbers that belong to this messages:
http://www.blitzbasic.com/Community/posts.php?topic=48153

The 'hwnd' of your window can be found with this:
print SystemProperty$("apphwnd")

You'll have to experiment to get this working. I'm not exactly sure how it should be done.