Animated Window - Tutorial
Add special effect to your form when it is showing and hiding! 6 types of effects can be applied. They are roll left to right, roll right to left, roll top to bottom, roll bottom to top, expand window outward and fade window. This program shows how to add these fancy effects. Make sure you have Windows 2000 and later or Windows 98 and later running before running this program. The program is well commented and a tutorial is included. Your comments and votes is the way you repay me for my work.
To add special effects when showing your form, 1 API is needed :
AnimateWindow
The AnimateWindow API is easy to use. It is contained in the "user32.dll" library. To call this API, first you need to declare it :
| Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean |
You will call the API like this :
| AnimateWindow hWnd, dwTime, dwFlags |
The parameters for this API :
| · hwnd [in] Handle to the window to animate. The calling thread must own this window. · dwTime [in] Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play. · dwFlags [in] Specifies the type of animation. This parameter can be one or more of the following values. &H40000 &H20000 &H80000 &H10000 &H10 &H1 &H2 &H4 &H8 |
The return values for this API once it is executed is :
| If the function succeeds, the
return value is nonzero. If the function fails, the return value is zero. The function will fail in the following situations: The window uses the window region. The window is already visible and you are trying to show the window. The window is already hidden and you are trying to hide the window. To get extended error information, call the GetLastError function. |
Lastly, wish you have good experiences programming with Visual Basic!
What I Would Like You to Do
- Leave comments about this program at
www.planetsourcecode.com/vb/
- Vote for this program at
www.planetsourcecode.com/vb/
- Visit my website
www.geocities.com/lamrihui/
All contents © Lam Ri Hui 2003