Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

AnimateWindow (user32)
 
.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool AnimateWindow(IntPtr hwnd, uint dwTime, uint dwFlags);

Or,

[DllImport("user32")]
static extern bool AnimateWindow(IntPtr hwnd, int time, AnimateWindowFlags flags);

VB Signature:

<DllImport("user32.dll")> _
Shared Function AnimateWindow(ByVal hwnd As IntPtr, ByVal dwTime As UInteger, ByVal dwFlags As UInteger) As Boolean
End Function

Or,

<DllImport("user32.dll")> _
Shared Function AnimateWindow(ByVal hwnd As IntPtr, ByVal time As Integer, ByVal flags As AnimateWindowFlags) As Boolean
End Function

User-Defined Types:

AnimateWindowFlags can be used for the dwFlags parameter.

Notes:

None.

Tips & Tricks:

To get an animation to run in reverse, to say, animate the window closing use some thing like:

Dim f2 As Form2
f2 = New Form2
AnimateWindow(f2.Handle, 1000, AnimateWindowFlags.AW_VER_NEGATIVE Or AnimateWindowFlags.AW_SLIDE or AnimateWindowFlags.AW_HIDE)
f2.Show()

The AW_HIDE will make any of the animations run in reverse.

Sample Code:

C#

This assumes that the AnimateWindow function is declared inside class User32

Form2 f2 = new Form2();
AnimateWindow( f2.Handle, 1000, (uint) AnimateWindowFlags.AW_VER_NEGATIVE |
                (uint) AnimateWindowFlags.AW_SLIDE );
f2.Show();

Alternative Managed API:

VB.NET Signature:

Public Declare Auto Function AnimateWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal time As Integer, ByVal flags As AnimateWindowFlags) As Boolean

Sample Code:

VB.NET

Dim f2 As Form2
f2 = New Form2
AnimateWindow(f2.Handle, 1000, AnimateWindowFlags.AW_VER_NEGATIVE Or AnimateWindowFlags.AW_SLIDE)
f2.Show()

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions