DefScreenSaverProc

Syntax

LONG DefScreenSaverProc(hWnd, msg, wParam, lParam)

This function performs the default actions for screen saver windows.

Parameters

HWND hWnd

Specifies a handle to the screen saver window.

unsigned msg

Specifies the message number. The DefScreenSaverProc function responds to messages that affect screen saver operation as follows:

WM_ACTIVATE, WM_ACTIVATE_APP

If wParam is FALSE, the window is losing its focus and the screen saver shell terminates.

WM_ERASEBKGND

Paints the screen background black.

WM_LBUTTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN

The screen saver shell changes the mouse coordinates. The screen saver shell terminates in response to the resulting WM_MOUSEMOVE message.

WM_KEYDOWN, WM_SYSKEYDOWN

The screen saver shell terminates on this message.

WM_MOUSEMOVE

The shell determines if the mouse has moved, or if it is just being placed on the window again. If the mouse has moved, the screen saver shell terminates.

WM_DESTROY

When the window gets closed, the program should terminate, and the screen saver shell terminates when it receives this message.

If your screen saver needs to perform a different action in response to any of these messages, your ScreenSaverProc function should process the message and not call DefScreenSaverProc for that message.

WORD wParam

Specifies additional message-dependent information.

LONG lParam

Specifies additional message-dependent information.

Return Value

The return value specifies the result of the message processing and depends on the actual message sent.

Comments

In the ScreenSaverProc window procedure of your screen saver, use DefScreenSaverProc in place of DefWindowProc. The DefScreenSaverProc function passes any messages that do not affect screen saver operation to DefWindowProc.