summaryrefslogtreecommitdiff
path: root/shared/disable_standby.h
blob: 399d0b9c528841a5082575e820beeb7c0e8da258 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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