The information in this article applies to:
SUMMARYSometimes applications need to terminate a screen saver that is already running. In Windows 3.1 or Windows 95, a screen saver could be terminated easily by posting a WM_CLOSE message to the currently active screen saver window as in this example:
Windows NT, however, introduces the concept of separate desktops, so that
applications can run on one, and screen savers can run on another. This
makes screen saver termination under Windows NT a bit more difficult.
MORE INFORMATION
Obtaining a handle to the currently active screen saver window under Windows
NT is not as straightforward as it is in Windows 3.1 and Windows 95.
Calling GetForegroundWindow() returns NULL because the screen saver is
running on a different desktop than the calling application. Similarly,
calling FindWindow ("WindowsScreenSaverClass", NULL) to determine if the
screen saver is currently active does not work either.
Note that terminating a screen saver that is already running as demonstrated
above is totally separate from disabling the screen saver altogether,
so that no screen saver starts after the designated time period expires.
This can be done easily using:
This method works well for terminating the currently running screen saver.
However, one problem that you might encounter is that the system will not
restart the screen saver unless the user moves the mouse or presses a key.
If you need the screen saver to start up again, you'll need to reinitialize
the time-out period. Do this by:
Additional query words: deactivate disable stop running turn off screensaver
Keywords : kbcode kbNTOS kbNTOS310 kbNTOS350 kbNTOS351 kbNTOS400 kbWinOS2000 kbScreenSaver kbSDKWin32 kbGrpUser |
Last Reviewed: February 1, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |