« Puzzle: What the Sam Hill? | Main | Windows Screen Savers: Bullets Updated »

Sunday, July 23, 2006

Windows Screen Savers: Craters, Earth, and Sky Updated

The Craters, Earth, and Sky screen savers have been updated to be compatible with dual-screen configurations on Windows XP and store their settings in the registry under HKEY_CURRENT_USER, which allows different users of the same machine to have their own individual preferences for the same screen saver (and, more importantly, users without administrative privileges to save their preferences).

All of these screen savers have been re-built with Microsoft Visual C 7.0 (Visual Studio .NET) and dual screen operation verified on my development machine. I ran into a curious problem in the Craters screen saver, which is “legacy code” originally written for 16-bit Windows 3.1. It used GetWindowRect(GetDesktopWindow(),…) to determine the size of the screen. In fact, on Windows XP Professional, this call returns only the horizontal dimension of the first configured monitor; I have no idea what vertical dimension it returns if two displays with different heights are configured. Programs which care about the dimensions of the actual composite screen should call GetClientRect with the handle to the window passed to the screen saver's WindowProc, which returns the true dimensions of the adjacent screens.

Update: I have added the Sky screen saver to the list of those updated as I found the time today to integrate the registry settings code and I didn't want to burden those who follow RSS updates with an announcement of such a minor event. (2006-07-23 21:47 UTC).

Update: I've rewritten the second paragraph of this item to clarify that the problem which caused the Craters screen saver to paint only the first of a dual monitor configuration was that it called GetWindowRect to determine the screen dimensions, not that it obtained the handle of the desktop window with GetDesktopWindow . (2006-07-24 13:32 UTC).

Posted at July 23, 2006 23:47