Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop system entering 'standby'

How can i stop the host machine entering standby mode while my application is running?

Is there any win32 api call to do this?

like image 462
prakash Avatar asked Jan 24 '23 03:01

prakash


1 Answers

There are two APIs, depending on what version of Windows.

XP,2000, 2003:

http://msdn.microsoft.com/en-us/library/aa373247(VS.85).aspx

Respond to PBT_APMQUERYSUSPEND.

Vista, 2008:

http://msdn.microsoft.com/en-us/library/aa373208(VS.85).aspx

There could be many valid reasons to prevent the computer from going to sleep. For example, watching a video, playing music, compiling a long running build, downloading large files, etc.

like image 136
Brannon Avatar answered Jan 26 '23 18:01

Brannon