|
Writing a Screen Saver (2) |
|
| So, assuming we know what the program should do, it's all pretty much standard Windows stuff. Create a window (the same size as the parent window for previews, and a full screen window otherwise) and write a windows procedure that destroys the window on any kind of user input (see below for info on the password protection). If you keep the coordinate information based on the window size, you'll be able to use the same drawing procedure for both the full-size window and the preview. | |
Drawing the window is handled a little differently than in ordinary Windows. Normally, the
windows procedure responds to the WM_DRAW message, gets a clip region with BeginPaint()
and then paints whatever in the region. When the screen is updated constantly, you use
the GetWindowDC() function and paint whatever on the screen, after blacking out the previous
image. Using the standard GDI graphics, you could clear the screen with
|
|
The password is handled differently on
Windows NT/XP and Windows 95/98. NT has the password security built in, so
on that OS we don't have to do an explicit pwd check. On 95/98, the screensaver password
provider is a DLL called "password.cpl" that exports the function
VerifyScreenSavePwd(HWND wndParent). But before calling that function, we
have to check whether the password is enabled at all. The password on/off flag is stored
as a boolean value in the registry, under:
HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaveUsePasswordThe password checking procedure then goes like this in pseudo code:
| |
| Next | |
| Previous |