AnimateWindow

[This is preliminary documentation and subject to change.]

The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are two types of animation: roll animation and slide animation.

BOOL AnimateWindow(
  HWND hwnd,     // handle to the window to animate
  DWORD dwTime,  // duration of animation
  DWORD dwFlags  // animation type
);
 

Parameters

hwnd
Specifies a handle to the window to animate.
dwTime
Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
dwFlags
Specifies the type of animation. This parameter can be one or more of the following flags.
Flag Description
AW_SLIDE Uses slide animation. By default, roll animation is used. This flag is ignored when used with the AW_CENTER flag.
AW_ACTIVATE Activates the window. Do not use this flag with AW_HIDE.
AW_BLEND Uses a fade effect. This flag can be used only if hwnd is a top-level window.
AW_HIDE Hides the window. By default, the window is shown.
AW_CENTER Makes the window appear to collapse inward if the AW_HIDE flag is used or expand outward if the AW_HIDE flag is not used.
AW_HOR_POSITIVE Animate the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with the AW_CENTER flag.
AW_HOR_NEGATIVE Animate the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with the AW_CENTER flag.
AW_VER_POSITIVE Animate the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with the AW_CENTER flag.
AW_VER_NEGATIVE Animate the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with the AW_CENTER flag.

Return Values

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:

To get extended error information, call the GetLastError function.

Remarks

You can combine the AW_HOR_POSITIVE or AW_HOR_NEGATIVE flag with the AW_VER_POSITIVE or AW_VER_NEGATIVE flag to animate a window diagonally.

The window procedures for the window and its child windows may need to 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.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Requires Windows 98 or later.
  Windows CE: Unsupported.
  Header: Declared in winuser.h.
  Import Library: Use user32.lib.

See Also

Windows Overview, Window Functions, WM_PRINT, WM_PRINTCLIENT