Solved

AnimateWindow API

Posted on 2004-08-09
4
620 Views
Last Modified: 2008-01-09
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.
0
Comment
Question by:UrbanPuppet
  • 2
4 Comments
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
Add AW_ACTIVATE flag 0x00020000) to the last parameter:

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

0
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
This is code fragment from the test VC++ project which gives desired result:

void CTestDlg::OnButton1()
{
    ShowWindow(SW_HIDE);
   
    AnimateWindow(m_hWnd, 450,
                           AW_SLIDE | AW_VER_NEGATIVE | AW_ACTIVATE);
                           // 0x00040000  0x00000008        0x00020000
}
0
 

Author Comment

by:UrbanPuppet
Comment Utility
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..
0
 

Accepted Solution

by:
todd_ earned 150 total points
Comment Utility
  <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


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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now