Results 1 to 6 of 6

Thread: Problem with AnimateWindow()

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Posts
    484

    Problem with AnimateWindow()

    Hi,

    I tried the following code to try to 'disolve' a form window but when i press the button, nothing happens. Know why?

    Pls tell me , many many thanx~!

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function AnimateWindow Lib "user32" ( _
    4.            ByVal hwnd As Long, _
    5.            ByVal dwTime As Long, _
    6.            ByVal dwFlags As Long _
    7. ) As Boolean
    8.  
    9. Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
    10. Const AW_SLIDE = &H40000
    11.  
    12. Private Sub Command1_Click()
    13. Me.AutoRedraw = True
    14.  
    15. Dim RetVal
    16. AnimateWindow Me.hwnd, 4000, AW_BLEND
    17.  
    18. End Sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Try this:
    VB Code:
    1. Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean
    2.  
    3. Private Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation.
    4. Private Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation.
    5. Private Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation.
    6. Private Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation.
    7. Private 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.
    8. Private Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown.
    9. Private Const AW_ACTIVATE = &H20000 'Activates the window.
    10. Private Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used.
    11. Private Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
    12.  
    13. Private Sub Form_Unload(Cancel As Integer)
    14. AnimateWindow Me.hwnd, 200, AW_VER_POSITIVE Or AW_HOR_NEGATIVE Or AW_HIDE
    15. End Sub
    16.  
    17. Private Sub Form_Load()
    18. Me.AutoRedraw = True
    19. End Sub
    Take your code out of the command button click event and put it in the form_unload event (also, you dim RetVal and then don't do anything with it )

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Posts
    484
    why did u put more than one flags when calling the function ??
    And what does the 'Or' keyword do in that case. Also, i don't seem to get the aw_blend to work, but the code u gave me worked fine.

    pls explain

    thanx!@

  4. #4
    CallieO
    Guest
    Flag bits are set or are clear in the constant. Or sets all the bits from each flag, so the effect is combined.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Callieo beat me to it.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Posts
    484
    mmmmmmmm interesting...

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