How to create a snowstorm on your Windows desktop?
Posted
by
Vilx-
on Stack Overflow
See other posts from Stack Overflow
or by Vilx-
Published on 2011-01-11T13:47:54Z
Indexed on
2011/01/11
13:54 UTC
Read the original article
Hit count: 249
Practical uses aside, how (if it is possible at all) could you create a "snowing" effect on your desktop PC running Windows? Preferably with nothing but raw C/C++ and WinAPI.
The requirements for the snow are:
- Appears over everything else shown;
- Snowflakes are small, possibly simple dots or clusters of a few white pixels;
- Does not bother working with the computer (clicking a snowflake sends the click through to the underlying window);
- Plays nicely with users dragging windows;
- Multimonitor capable.
Bonus points for any of the following features:
- Snow accumulates on the lower edge of the window or the taskbar (if it's at the bottom of the screen);
- Snow accumulates also on top-level windows. Or perhaps some snow accumulates, some continues down, accumulating on every window with a title bar;
- Snow accumulated on windows gets "shaken off" when windows are dragged;
- Snow accumulated on taskbar is aware of the extended "Start" button under Vista/7.
- Snowflakes have shadows/outlines, so they are visible on white backgrounds;
- Snowflakes have complex snowflike-alike shapes (they must still be tiny).
Most of these effects are straightforward enough, except the part where snow is click-through and plays nicely with dragging of windows. In my early days I've made an implementation that draws on the HDC you get from GetDesktopWindow()
, which was click-through, but had problems with users dragging windows (snowflakes rendered on them got "dragged along").
The solution may use Vista/7 Aero features, but, of course, a universal solution is preferred. Any ideas? :)
© Stack Overflow or respective owner