I'm trying to use SystemParametersInfo in order to disable/ enable the screen saver. I try this:
[DllImport("user32", CharSet=CharSet.Auto)]
private static extern bool SystemParametersInfo(int uAction, bool uParam, int lpvParam, int fuWinIni);
[DllImport("user32", CharSet=CharSet.Auto)]
private static extern bool SystemParametersInfo(int uAction, int uParam, bool lpvParam, int fuWinIni);
private const int HWND_BROADCAST = 65535;
private const int WM_SYSCOMMAND = 274;
private const int SC_SCREENSAVE = 61760;
private const int SPI_GETSCREENSAVETIMEOUT = 14;
private const int SPI_SETSCREENSAVETIMEOUT = 15;
private const int SPIF_UPDATEINIFILE = 1;
private const int SPIF_SENDWININICHANGE = 2;
private const int SPI_SETSCREENSAVEACTIVE = 17;
private const int SPI_GETSCREENSAVEACTIVE = 16;
bool IsActive;
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, IsActive, 0);
// disable the screen saver if it is enabled
if(IsActive)
{
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, false, 0, 0);
}
But it doesn't work :( I'm not sure that the SystemParametersInfo is OK, and I don't know how to use SPI_GETSCREENSAVEACTIVE and SPI_SETSCREENSAVEACTIVE.
I prefer the Windows Vista Startup sound. It was designed in accordance with Windows AERO principles; the sound itself, among other niceties "has two parallel melodies played in an intentional 'Win-dows Vis-ta' rhythm".
Before Windows Vista was released to manufacturing there were discussions about this Startup sound being mandatory like the startup sound of the Xbox 360. (This did not happen.)
(I recall and appreciate that it is Windows Vista that first allowed users to disable only Windows sounds from the Volume Mixer.)
For sure, Windows 7 had quite good design with its transparency, as did Vista. The early Longhorn builds and prototypes definitely went too far, but certainly looked a lot nicer. They weren't particularly practical, with some text difficult to read, with attempts to add contrast with weird drop shadow glows around text.
I believe the reason they stepped away from that was partly to do with accessibility of a standard Windows desktop having the right levels of contrast. From memory, they made a point of this in Office 2010, when Office 2007's ribbon didn't conform to access ability standards with poor contrasted text on the blue background.
Question
yyy
Hello,
I'm trying to use SystemParametersInfo in order to disable/ enable the screen saver. I try this:
But it doesn't work :( I'm not sure that the SystemParametersInfo is OK, and I don't know how to use SPI_GETSCREENSAVEACTIVE and SPI_SETSCREENSAVEACTIVE.
Can anybody please tell me how to use it ?
Link to comment
https://www.neowin.net/forum/topic/298659-c-enable-disable-screen-saver/Share on other sites
9 answers to this question
Recommended Posts