From: APTX Date: Sat, 16 Aug 2014 10:55:01 +0000 (+0200) Subject: Prevent windows from turning off the screen when video is playing. X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=8667853f1821899cdba2dcae040f3f8a0e834fce;p=aniplayer2.git Prevent windows from turning off the screen when video is playing. --- diff --git a/aniplayer_dshow/aniplayerdshowinternal.cpp b/aniplayer_dshow/aniplayerdshowinternal.cpp index d0f301e..4c7e27d 100644 --- a/aniplayer_dshow/aniplayerdshowinternal.cpp +++ b/aniplayer_dshow/aniplayerdshowinternal.cpp @@ -57,19 +57,34 @@ AniPlayerDShowInternal::~AniPlayerDShowInternal() bool AniPlayerDShowInternal::play() { HRESULT hr = pControl->Run(); - return SUCCEEDED(hr); + + if (FAILED(hr)) + return false; + + SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED); + return true; } bool AniPlayerDShowInternal::pause() { - HRESULT hr = pControl->Pause(); - return SUCCEEDED(hr); + HRESULT hr = pControl->Pause(); + + if (FAILED(hr)) + return false; + + SetThreadExecutionState(ES_CONTINUOUS); + return true; } bool AniPlayerDShowInternal::stop() { HRESULT hr = pControl->Stop(); - return SUCCEEDED(hr); + + if (FAILED(hr)) + return false; + + SetThreadExecutionState(ES_CONTINUOUS); + return true; } QSize AniPlayerDShowInternal::videoSize() const