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

ID: Q230117


The information in this article applies to:
  • Microsoft Windows NT 4.0 SP4


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.


MORE INFORMATION

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:
    
    SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, 0, 0); 


  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:
    
    OpenDesktop("Screen-saver", 0, FALSE, DESKTOP_READOBJECTS); 



REFERENCES

For additional information, please see the following article in the Microsoft Knowledge Base:

Q140723 HOWTO: Force a Screen Saver to Close Once Started in Windows NT

Additional query words:

Keywords : kbNTOS400bug kbScreenSaver kbSDKPlatform kbGrpUser kbNTOS400sp4bug
Version : winnt:4.0 SP4
Platform : winnt
Issue type : kbbug


Last Reviewed: April 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.