Thursday, April 22, 2010

Fading windows in and out

Well, finally a new (though short) post :-)

For personal needs, I coded the functionality to fade in a window when my application starts and fade it smoothly out when the user quits the application. So below you can download the result - just add the fade.h and fade.cpp to your project, call InitFadeEngine() to initialize the fade engine with your window and then simply use FadeIn() or FadeOut() function. Have a look in the header file to get information about the required parameters and I also suggest to look at the source of the demo application that is also in the archive below - there you see how to use it. It's coded in plain C using the WinAPI function SetLayeredWindowAttributes() that is called repeatedly in its own thread. Have fun!