Microsoft KB Archive/230117

{|
 * width="100%"|

BUG: OpenDesktop ("screen-saver",...) Returns a Valid Handle When the Screen Saver Is Not Running

 * }

Q230117

-

The information in this article applies to:


 * Microsoft Windows NT Server version 4.0 SP4
 * Microsoft Windows NT Workstation version 4.0 SP4
 * the operating system: Microsoft Windows 2000

-

SYMPTOMS
When you open the screen saver desktop by calling OpenDesktop, a valid handle may be returned even when the screen saver is not running. This problem occurs on Windows NT 4.0 with Service Pack 4 and may cause problems in applications that rely upon OpenDesktop("screen-saver, ...) to return a NULL handle when the screen saver is not running.

RESOLUTION
Check the validity of the desktop handle based on the function you use it in. For instance, if you use the desktop handle to enumerate the windows of this desktop, you may encounter the problem that the windows of the default desktop get enumerated.

For additional information on how to work around this problem, use the solution suggested in the following article in the Microsoft Knowledge Base:

"Q198590 BUG: EnumDesktopWindows Might Enumerate the Wrong Desktop"

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

Steps to Reproduce Behavior

 * 1) In the Properties for the desktop, ensure that no screen saver is set. Set the screen saver timeout to n ( = 1, for example) seconds.
 * 2) Programmatically enable the screen saver for the system by using SystemParametersInfo, passing SPI_SETSCREENSAVEACTIVE for uiAction and TRUE for uiParam:
 * 3) At the end of n seconds of inactivity of the mouse/keyboard, the screen saver does not kick in, but calling OpenDesktop of the screen saver desktop returns a non-NULL handle. You can open the screen saver desktop for reading using the following call: