User32AnimateWindow(IntPtr, Int32, WindowAnimation) Method

Produces special effects when showing or hiding a window.

This doesn't show the window so make sure you call Show or set Visible property to after calling AnimateWindow(IntPtr, Int32, WindowAnimation).

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", SetLastError = true)]
public static bool AnimateWindow(
	IntPtr hWnd,
	int time,
	WindowAnimation animation
)

Parameters

hWnd  IntPtr
A IntPtr handle to the window to animate.

The calling thread must own this window.

time  Int32
The time it takes to play the animation, in milliseconds.

Typically, an animation takes 200 milliseconds to play.

animation  WindowAnimation
The type of animation.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

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.

When trying to animate a child window with ShowFade or HideFade.

If the thread does not own the window. Note that, in this case, AnimateWindow(IntPtr, Int32, WindowAnimation) fails but GetLastWin32Error returns ERROR_SUCCESS.

Remarks

See Also