Hi MV
I can not depend on external tool
The code embedded into the MMplayer code
It runs when you run your code so if your application crashed for some reason your system still have its defaults no problem
This technique is foolproof for all Windows versions(By testing) and so simple
and
no side effects
Some of other techniques if you want to read some more
http://www.codeproject.com/Tips/125769/ ... creensaver
Code: Select all
SystemParametersInfo_(#SPI_SETSCREENSAVEACTIVE, 1, 0, #SPIF_SENDWININICHANGE)
;****************************************************************
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
Case WM_SYSCOMMAND:
{
switch (wParam)
{
Case SC_SCREENSAVE:
Return 0;
Case SC_MONITORPOWER:
Return 0;
}
Break;
}
Case WM_CLOSE:
{
PostQuitMessage(0);
Return 0;
}
}
Return DefWindowProc(hWnd,uMsg,wParam,lParam);
;****************************************************************
[ SMPlayer Support Forum
Index: src/screensaver.cpp
==================================================
--- src/screensaver.cpp (revision 5760)
+++ src/screensaver.cpp (working copy)
@@ -85,7 +85,8 @@
SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, poweroff, NULL, 0);
}
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, screensaver, NULL, 0);
-
+ SetThreadExecutionState(ES_CONTINUOUS);
+
qDebug("WinScreenSaver::restoreState: lowpower: %d, poweroff: %d, screensaver: %d", lowpower, poweroff, screensaver);
#else
If (SSCore_TempEnable) {
@@ -117,6 +118,7 @@
SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
}
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
+ SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
#else
If (SSCore_TempDisable) {
SSCore_TempDisable();
Index: src/screensaver.h
==================================================
--- src/screensaver.h (revision 5760)
+++ src/screensaver.h (working copy)
@@ -23,6 +23,8 @@
#ifdef Q_OS_OS2
#include <QLibrary>
+#else
+#define _WIN32_WINNT 0x0501
#endif
class WinScreenSaver
;***************************************************************
To disable Or enable screen saver using registry key
Set the value of the registry value ScreenSaveActive To 0. From command line you can run the below command For doing this.
Reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 0 /f
To enable screen saver:
Reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f
in Case of a ctrl+alt+del Or a crash the screensaver won't go back to normal
SMPlayer one of the best mmedia players at the moment
I just picked Mouse jiggler to be my favorite