PRB: Behavior of Screen Saver with keybd_event and mouse_event

ID: Q201833


The information in this article applies to:


SYMPTOMS

Screen savers react differently to keybd_event and mouse_event APIs on different operating systems. Usually, on getting the keyboard or mouse event, a screen saver should close or bring up a password dialog box (if it is password-protected) on a keyboard/mouse event. Even if it assumed that the screen saver closes on a keyboard/mouse event, the behavior is not the same across the different Windows operating systems. This article lists screen saver behavior on different operating systems.


MORE INFORMATION

When the screen saver is active and keybd_event or mouse_event is invoked programatically at the user level to synthesize a keystroke or to synthesize mouse action, respectively, the behavior described below occurs. (When these API's are called at the driver level, they behave appropriately; that is, they always reset the screen saver timer or terminate the screen saver if it is already running.)

Windows 95, 98:

If keybd_event is sent before the screen saver's timer times out, keybd_event prevents the screen saver from running by resetting its timer; however, mouse_event can not do this. Also, the currently running screen saver is terminated by keybd_event, but not by mouse_event.

Windows NT 3.51, 4.0:

If mouse_event is sent before the screen saver's timer times out, mouse_event prevents the screen saver from running by resetting its timer; however, keybd_event can not do this. If the screen saver is already running, then neither keybd_event nor mouse_event can terminate it because it is running in a different desktop.

The workaround for this is described in the following article in the Microsoft Knowledge Base:

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

This behavior may change in Windows 2000.


REFERENCES

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

Q140723 How to Force a ScreenSaver to Close Once Started in Windows NT

Additional query words: kbDSupport


Keywords          : kbKeyIn kbMouse kbScreenSaver 
Version           : WINDOWS:
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: January 23, 1999