How can I stop the host computer entering standby mode while my application is running?
standby
Is there a win32 api call for this?
win32 api
Depending on the version of Windows, there are two APIs.
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 can be many good reasons for the computer not to fall asleep. For example, watching videos, playing music, compiling a lengthy build, downloading large files, etc.
This article http://www.codeguru.com/cpp/wp/system/messagehandling/article.php/c6907 demonstrates how to do this with C ++ (thought the article was written as if you want to do it is from Java and provides a Java shell).
The actual code in the zip file is at http://www.codeguru.com/dbfiles/get_file/standbydetectdemo_src.zip?id=6907&lbl=STANDBYDETECTDEMO_SRC_ZIP&ds=20040406 , and part of C ++ is in com / ha / common / windows / standbydetector.
Hope this gives you enough start to get started.
Source: https://habr.com/ru/post/1276643/More articles:Using Microsoft Application Blocks - design-patternsWhat is the best approach when porting legacy projects to visual studio versions? - visual-studioPHP multi-level validation and redirection - postOR Home Rrown Framework Enterprise Library Application Blocks? - .netWin32 CreatePatternBrush - winapiRemoving web.config from subversion (ASP.NET project) - svnThe command system gets the latest version when placing an order - tfsHow to avoid XML content using XSL to safely output it as JSON? - jsonIs there a way to parse a SQL query to infer column names and table names? - sqlAutomatic email processing in Java - javaAll Articles