summaryrefslogtreecommitdiff
path: root/shared/disable_standby.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:09:45 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:09:45 +0200
commit88c8801298cbf6fec9cdce254c7b3cb9e066a421 (patch)
tree35a35acf48eb227bac30abc8f87ea9b1c3c57b68 /shared/disable_standby.h
parent3.12 (diff)
downloadFreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.tar.gz
FreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.tar.bz2
FreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.zip
3.13
Diffstat (limited to 'shared/disable_standby.h')
-rw-r--r--shared/disable_standby.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/shared/disable_standby.h b/shared/disable_standby.h
new file mode 100644
index 00000000..399d0b9c
--- /dev/null
+++ b/shared/disable_standby.h
@@ -0,0 +1,30 @@
+#ifndef PREVENTSTANDBY_H_INCLUDED
+#define PREVENTSTANDBY_H_INCLUDED
+
+#ifdef FFS_WIN
+#include <wx/msw/wrapwin.h> //includes "windows.h"
+#endif
+
+namespace util
+{
+class DisableStandby
+{
+public:
+ DisableStandby()
+ {
+#ifdef FFS_WIN
+ ::SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED /* | ES_AWAYMODE_REQUIRED*/ );
+#endif
+ }
+
+ ~DisableStandby()
+ {
+#ifdef FFS_WIN
+ ::SetThreadExecutionState(ES_CONTINUOUS);
+#endif
+ }
+
+};
+}
+
+#endif // PREVENTSTANDBY_H_INCLUDED
bgstack15