Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

AnimateWindow API

Posted on 2004-08-09
4
Medium Priority
?
641 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 600 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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 …
Integration Management Part 2
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

927 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