示例#1
0
        public static bool GetScreenSaverRunning()
        {
            bool lpvParam = false;

            ScreenSaver.SystemParametersInfo(114, 0, ref lpvParam, 0);
            return(lpvParam);
        }
示例#2
0
        public static int GetScreenSaverTimeout()
        {
            int lpvParam = 0;

            ScreenSaver.SystemParametersInfo(14, 0, ref lpvParam, 0);
            return(lpvParam);
        }
示例#3
0
        public static bool GetScreenSaverActive()
        {
            bool lpvParam = false;

            ScreenSaver.SystemParametersInfo(16, 0, ref lpvParam, 0);
            return(lpvParam);
        }
示例#4
0
 private static bool KillScreenSaverFunc(IntPtr hWnd, IntPtr lParam)
 {
     if (ScreenSaver.IsWindowVisible(hWnd))
     {
         ScreenSaver.PostMessage(hWnd, 16, 0, 0);
     }
     return(true);
 }
示例#5
0
        public static void KillScreenSaver()
        {
            IntPtr hDesktop = ScreenSaver.OpenDesktop("Screen-saver", 0, false, 129U);

            if (hDesktop != IntPtr.Zero)
            {
                ScreenSaver.EnumDesktopWindows(hDesktop, new ScreenSaver.EnumDesktopWindowsProc(ScreenSaver.KillScreenSaverFunc), IntPtr.Zero);
                ScreenSaver.CloseDesktop(hDesktop);
            }
            else
            {
                ScreenSaver.PostMessage(ScreenSaver.GetForegroundWindow(), 16, 0, 0);
            }
        }
示例#6
0
        public static void SetScreenSaverTimeout(int Value)
        {
            int lpvParam = 0;

            ScreenSaver.SystemParametersInfo(15, Value, ref lpvParam, 2);
        }
示例#7
0
        public static void SetScreenSaverActive(int Active)
        {
            int lpvParam = 0;

            ScreenSaver.SystemParametersInfo(17, Active, ref lpvParam, 2);
        }