Solved

AnimateWindow API

Posted on 2004-08-09
4
634 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: 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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

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