Results 1 to 4 of 4

Thread: User32 Animate Window Function

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Posts
    30

    User32 Animate Window Function

    I cant figure out the correct declare statment for the user32 function AnimateWindow. its prototype is:

    BOOL AnimateWindow(
    HWND hwnd, // handle to window
    DWORD dwTime, // duration of animation
    DWORD dwFlags // animation type
    );


    What is the equivelant of the DWORD in VB., or rather, what would the prototype look like in vb?

    Thanks again.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Posts
    30

    sorry for the repost

    clicked the back button and resubmitted the post by accident... sorry

  3. #3
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    The DWORD equavllent in VB is Long (as to almost every other datatype j.k). Here it is:
    Code:
    Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean
    
    · hwnd
    [in] Handle to the window to animate. The calling thread must own this window.
    
    · dwTime
    [in] Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
    
    · dwFlags
    [in] Specifies the type of animation. This parameter can be one or more of the following values.
    AW_SLIDE
     Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER.
    AW_ACTIVATE
     Activates the window. Do not use this value with AW_HIDE.
    AW_BLEND
     Uses a fade effect. This flag can be used only if hwnd is a top-level window.
    AW_HIDE
     Hides the window. By default, the window is shown.
    AW_CENTER
     Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
    AW_HOR_POSITIVE
     Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_HOR_NEGATIVE
     Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_VER_POSITIVE
     Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_VER_NEGATIVE
     Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Here is an example
    VB Code:
    1. Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation.
    2. Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation.
    3. Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation.
    4. Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation.
    5. Const AW_CENTER = &H10 'Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
    6. Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown.
    7. Const AW_ACTIVATE = &H20000 'Activates the window.
    8. Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used.
    9. Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
    10. Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean
    11. Private Sub Form_Load()'Set the graphic mode to persistent
    12.     Me.AutoRedraw = True
    13.     Me.Print "Unload me"
    14. End Sub
    15. Private Sub Form_Unload(Cancel As Integer)
    16.     'Animate the window
    17.     AnimateWindow Me.hwnd, 200, AW_VER_POSITIVE Or AW_HOR_NEGATIVE Or AW_HIDE
    18.     'Unload our form completely
    19.     Set Form1 = Nothing
    20. End Sub
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width