AnimateWindow API

I'm having trouble getting the AnimateWindow API working in VB.NET. Here's the declaration:

Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean

And the code I'm using is:

AnimateWindow(frmNotification.Handle.ToInt32, 450, &H8 Or &H40000)

At the time the function is called, the form is hidden (it will definitely fail otherwise). I can't figure out why it's not working. I want it to slide up from the bottom left corner of the screen but currently, nothing happens.
Who is Participating?
todd_Connect With a Mentor Commented:
  <FlagsAttribute()> _
   Public Enum AnimateWindowFlags
       AW_HOR_POSITIVE = &H1
       AW_HOR_NEGATIVE = &H2
       AW_VER_POSITIVE = &H4
       AW_VER_NEGATIVE = &H8
       AW_CENTER = &H10
       AW_HIDE = &H10000
       AW_ACTIVATE = &H20000
       AW_SLIDE = &H40000
       AW_BLEND = &H80000
   End Enum
   Public Declare Auto Function AnimateWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal time As Integer, ByVal flags As AnimateWindowFlags) As Boolean

       Dim f2 As Form2
       f2 = New Form2
       AnimateWindow(f2.Handle, 1000, AnimateWindowFlags.AW_VER_NEGATIVE Or AnimateWindowFlags.AW_SLIDE)
Add AW_ACTIVATE flag 0x00020000) to the last parameter:

AnimateWindow(frmNotification.Handle.ToInt32, 450, &H8 Or &H40000 Or &H20000)

This is code fragment from the test VC++ project which gives desired result:

void CTestDlg::OnButton1()
    AnimateWindow(m_hWnd, 450,
                           AW_SLIDE | AW_VER_NEGATIVE | AW_ACTIVATE);
                           // 0x00040000  0x00000008        0x00020000
UrbanPuppetAuthor Commented:
It seems you have the same thing (different languages) but with the AW_ACTIVATE flag, it still doesn't work.

If it means anything, the form is created in a class.. so it's like

Dim frmNotification As New Form
'set some form properties
'try to display form with AnimateWindow
'become disappointed that it doesn't work

The form does have a background image on it if that matters..
All Courses

From novice to tech pro — start learning today.