Jump to content

VistaWinAnimate() UDF


Valuater
 Share

Recommended Posts

There seems to be a problem with the window animation using the DLL Call

This should work on Vista and all other OS too! (Autoit OS)

; Demo

#include <GUIConstants.au3>
Dim $repeat = 0
$hwnd = GUICreate("XSkin Animate", 300, 300)

While $repeat <= 8
    $repeat += 1
    _VistaWinAnimate($hwnd, $repeat, 0)

    Sleep(2000)

    _VistaWinAnimate($hwnd, $repeat, 1)
    Sleep(2000)
WEnd


Func _VistaWinAnimate($Xwnd, $Xstyle = 0, $Xstate = 0, $Xdistance = 100, $Xdelay = 10)
    ; $Xstate  - 0 = Show, 1 = Hide,
    ; $Xstyle - 1=Fade, 2=L-Slide, 3=R-Slide, 4=T-Slide, 5=B-Slide, 6=TL-Diag-Slide, 7=BL-Diag-Slide, 8=TR-Diag-Slide, 9=BR-Diag-Slide

    ; Error checking...
    If Not WinExists($Xwnd) Then Return SetError(1, -1, "window does not exist")
    If Not $Xstate == 0 Or Not $Xstate == 1 Then Return SetError(2, -1, "State is not Show or Hide")
    If $Xstyle == 0 Or $Xstyle >= 10 Then Return SetError(3, -1, "Style is out-of-range")

    ; Find Window location and Centered...
    Local $XPos = WinGetPos($Xwnd), $X_Move = 0, $Y_Move = 0, $MoveIt = 0
    $X_Start = $XPos[0]
    $Y_Start = $XPos[1]
    $X_Final = (@DesktopWidth / 2) - ($XPos[2] / 2)
    $Y_Final = (@DesktopHeight / 2) - ($XPos[3] / 2)

    If $Xstate == 0 Then ; to Show the GUI
        WinSetTrans($Xwnd, "", 0)
        GUISetState(@SW_SHOW, $Xwnd)
        $Xtrans = 255 / $Xdistance
        If $Xstyle = 2 Or $Xstyle = 6 Or $Xstyle = 7 Then
            $X_Move = 1
            $X_Final = $X_Final - $Xdistance
        ElseIf $Xstyle = 3 Or $Xstyle = 8 Or $Xstyle = 9 Then
            $X_Move = -1
            $X_Final = $X_Final + $Xdistance
        EndIf
        If $Xstyle = 4 Or $Xstyle = 6 Or $Xstyle = 8 Then
            $Y_Move = 2
            $Y_Final = $Y_Final - ($Xdistance * 2)
        ElseIf $Xstyle = 5 Or $Xstyle = 7 Or $Xstyle = 9 Then
            $Y_Move = -2
            $Y_Final = $Y_Final + ($Xdistance * 2)
        EndIf
    Else ; to hide the GUI
        $Xtrans = -1 * (255 / $Xdistance)
        $X_Final = $X_Start
        $Y_Final = $Y_Start
        If $Xstyle = 2 Or $Xstyle = 6 Or $Xstyle = 7 Then $X_Move = -1
        If $Xstyle = 3 Or $Xstyle = 8 Or $Xstyle = 9 Then $X_Move = 1
        If $Xstyle = 4 Or $Xstyle = 6 Or $Xstyle = 8 Then $Y_Move = -2
        If $Xstyle = 5 Or $Xstyle = 7 Or $Xstyle = 9 Then $Y_Move = 2
    EndIf
    If $Y_Move <> 0 Or $X_Move <> 0 Then $MoveIt = 1
    WinMove($Xwnd, "", $X_Final, $Y_Final)
    For $x = 1 To $Xdistance
        $XPos = WinGetPos($Xwnd)
        WinSetTrans($Xwnd, "", $x * $Xtrans)
        If $MoveIt = 1 Then WinMove($Xwnd, "", $XPos[0] + $X_Move, $XPos[1] + $Y_Move)
        Sleep($Xdelay)
    Next
    If $Xstate = 1 Then GUISetState(@SW_HIDE, $Xwnd)
EndFunc   ;==>_VistaWinAnimate

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...