AnimateWindow function (winuser.h)
Enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade.
BOOL AnimateWindow( [in] HWND hWnd, [in] DWORD dwTime, [in] DWORD dwFlags );
A handle to the window to animate. The calling thread must own this window.
The time it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
The type of animation. This parameter can be one or more of the following values. Note that, by default, these flags take effect when showing a window. To take effect when hiding a window, use AW_HIDE and a logical OR operator with the appropriate flags.
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:
- If the window is already visible and you are trying to show the window.
- If the window is already hidden and you are trying to hide the window.
- If there is no direction specified for the slide or roll animation.
- When trying to animate a child window with AW_BLEND.
- If the thread does not own the window. Note that, in this case, AnimateWindow fails but GetLastError returns ERROR_SUCCESS.
To show or hide a window without special effects, use ShowWindow.
When using slide or roll animation, you must specify the direction. It can be either AW_HOR_POSITIVE, AW_HOR_NEGATIVE, AW_VER_POSITIVE, or AW_VER_NEGATIVE.
You can combine AW_HOR_POSITIVE or AW_HOR_NEGATIVE with AW_VER_POSITIVE or AW_VER_NEGATIVE to animate a window diagonally.
The window procedures for the window and its child windows should handle any WM_PRINT or WM_PRINTCLIENT messages. Dialog boxes, controls, and common controls already handle WM_PRINTCLIENT. The default window procedure already handles WM_PRINT.
If a child window is displayed partially clipped, when it is animated it will have holes where it is clipped.
AnimateWindow supports RTL windows.
Avoid animating a window that has a drop shadow because it produces visually distracting, jerky animations.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||winuser.h (include Windows.h)|
|API set||ext-ms-win-ntuser-window-l1-1-0 (introduced in Windows 8)|