Solved

AnimateWindow API

Posted on 2004-08-09
4
629 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
ID: 11759627
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
ID: 11759636
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
ID: 11759774
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
ID: 11769353
  <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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SqlServer no dupes 25 38
Get number of Files in Directory and Sub Directories 2 48
Complex SQL statement in VB.NET 7 31
VB.Net Determine if a mapped network drive exists 2 31
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 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