• Offizieller Beitrag

    Nicht dass ihr denkt, ich erstelle nur Array-Funktionen :D

    Mit _SlideWindow($hWnd, [$iDirection=1 [, $Left=-1 [, $Top=-1 [, $Speed=2000]]]]) könnt ihr Fenster von/ nach allen 4 Seiten hereingleiten/ herausgleiten lassen.
    Die Geschwindigkeit ist allerdings sehr rechnerspezifisch, da die Bewegung Pixel für Pixel stattfindet, ist der Zeitfaktor für den Schleifendurchlauf je nach zurückzulegendem Weg recht groß.
    Erst bei sehr großen Werten (> 15000) entspricht dieser Wert etwa der Einblend/Ausblenddauer.
    $iDirection ist der Richtungsvektor:
    1 bis 4 von (rechts-unten-links-oben) - reingleiten
    -1 bis -4 nach (rechts-unten-links-oben) - rausgleiten
    $Left, $Top : Zielposition
    $Speed :Gleitgeschwindigkeit (sehr individuell)

    Wenn kein Fenstername/handle oder ein nicht existierender übergeben wird, wird die Funktion das aktive Fenster verwenden.

    EDIT:
    Habe das ganze jetzt noch um die Diagonalen erweitert.
    Der Richtungsvektor sieht jetzt so aus:

    Code
    8	4	5
    
    
    3		1
    
    
    7	2	6

    Hier mal ein Bsp. zum Testen:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    Opt("GUIOnEventMode", 1)
    $Main = GUICreate("Main Window", 700, 60, (@DesktopWidth-700)/2, 30)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Ende")
    GUICtrlCreateLabel("Left, Top:", 20, 23, 50, 17)
    $inX = GUICtrlCreateInput("-1", 80, 20, 40,20)
    $inY = GUICtrlCreateInput("-1", 130, 20, 40,20)
    $btn = GUICtrlCreateButton("Slide In/Out", 600, 20, 80, 20)
    GUICtrlSetOnEvent(-1, "_slide")
    GUICtrlCreateLabel("Richtung (OUT: -1 bis -4 / IN: 1 bis 4):", 180, 23, 200, 17)
    $inDir = GUICtrlCreateInput("1", 370, 20, 40, 20)
    GUICtrlCreateLabel("Speed:", 415, 23, 35, 17)
    $inTime = GUICtrlCreateInput(2000, 455, 20, 40, 20)
    GUICtrlCreateLabel("benötigte Zeit:", 515, 8, 70, 17, $SS_CENTER)
    $usedTime = GUICtrlCreateLabel("", 515, 30, 70, 17, $SS_CENTER)
    GUICtrlSetColor(-1, 0xFF0000)

    [/autoit] [autoit][/autoit] [autoit]

    $Child = GUICreate("Slide Window", 400, 300, -1, -1)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $Main)
    While 1
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Ende()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _slide()
    Local $x = GUICtrlRead($inX), $y = GUICtrlRead($inY)
    If GUICtrlRead($inDir) < 0 Then
    WinMove($Child, '', (@DesktopWidth-400)/2, (@DesktopHeight-300)/2)
    GUISetState(@SW_SHOW, $Child)
    Sleep(1000)
    Else
    GUISetState(@SW_SHOW, $Child)
    EndIf
    $begin = TimerInit()
    _SlideWindow($Child, GUICtrlRead($inDir), $x , $y, GUICtrlRead($inTime) )
    GUICtrlSetData($usedTime, Int(TimerDiff($begin)) & ' ms')
    Sleep(1000)
    GUISetState(@SW_HIDE, $Child)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;-----------------------------------------------------------------------------------------------------------------------
    ; Function _SlideWindow($hWnd, [$iDirection=1 [, $Left=-1 [, $Top=-1 [, $Speed=2000]]]])
    ;
    ; Description slide a window in/out from/to right/bottom/left/top in a given time
    ;
    ; Parameter $hWnd window -id
    ; $iDirection direction to slide in / out
    ; right: 1 / -1 top-right: 5 / -5
    ; bottom: 2 / -2 bot.-right: 6 / -6
    ; left: 3 / -3 bot.-left: 7 / -7
    ; top: 4 / -4 top-left: 8 / -8
    ; $Left window left position, default -1 (center)
    ; $Top window top position, default -1 (center)
    ; $Speed default 2000, used time in relationship to hardware, minimum=0
    ;
    ; Note Don't work with minimized windows. Works with hidden windows.
    ; If $hWnd does'nt exist, the active window will be used
    ;
    ; Author BugFix ([email='bugfix@autoit.de'][/email])
    ;-----------------------------------------------------------------------------------------------------------------------Func _SlideWindow($hWnd, $iDirection=1, $Left=-1, $Top=-1, $Speed=2000)
    Local $pos = WinGetPos($hWnd)
    Local $startX, $endX, $startY, $endY, $tpp, $x, $y
    If $Top = -1 Then $Top = (@DesktopHeight-$pos[3])/2
    If $Left = -1 Then $Left = (@DesktopWidth-$pos[2])/2
    If ( Not IsNumber($Speed) ) Or ( $Speed < 0 ) Then $Speed=2000
    If ($iDirection < -8) Or ($iDirection = 0) Or ($iDirection > 8) Then $iDirection = 1
    Switch $iDirection
    Case 1
    $startX = @DesktopWidth
    $endX = $Left
    $tpp = Int($Speed/($startX-$Left))
    For $i = $startX To $endX Step -1
    WinMove($hWnd, '', $i, $Top)
    Sleep($tpp)
    Next
    Case 2
    $startY = @DesktopHeight
    $endY = $Top
    $tpp = Int($Speed/($startY-$Top))
    For $i = $startY To $endY Step -1
    WinMove($hWnd, '', $Left, $i)
    Sleep($tpp)
    Next
    Case 3
    $startX = 0-$pos[2]
    $endX = $Left
    $tpp = Int($Speed/($Left+$pos[2]))
    For $i = $startX To $endX Step 1
    WinMove($hWnd, '', $i, $Top)
    Sleep($tpp)
    Next
    Case 4
    $startY = 0-$pos[3]
    $endY = $Top
    $tpp = Int($Speed/($Top+$pos[3]))
    For $i = $startY To $endY Step 1
    WinMove($hWnd, '', $Left, $i)
    Sleep($tpp)
    Next
    Case 5
    $startX = @DesktopWidth
    $startY = 0-($pos[3]/2)
    $endX = $Left
    $endY = $Top
    $absX = $startX-$endX
    $absY = $endY-$startY
    $weg = Sqrt($absX^2 + $absY^2)
    $tpp = Int($Speed/$weg)
    $stepY = $absY/$absX
    For $i = $startX To $endX Step -1
    WinMove($hWnd, '', $i, Int($startY))
    Sleep($tpp)
    $startY += $stepY
    Next
    Case 6
    $startX = @DesktopWidth
    $startY = @DesktopHeight-($pos[3]/2)
    $endX = $Left
    $endY = $Top
    $absX = $startX-$endX
    $absY = $endY-$startY
    $weg = Sqrt($absX^2 + $absY^2)
    $tpp = Int($Speed/$weg)
    $stepY = $absY/$absX
    For $i = $startX To $endX Step -1
    WinMove($hWnd, '', $i, Int($startY))
    Sleep($tpp)
    $startY += $stepY
    Next
    Case 7
    $startX = 0-($pos[2])
    $startY = @DesktopHeight-($pos[3]/2)
    $endX = $Left
    $endY = $Top
    $absX = $endX+Abs($startX)
    $absY = $endY-$startY
    $weg = Sqrt($absX^2 + $absY^2)
    $tpp = Int($Speed/$weg)
    $stepY = $absY/$absX
    For $i = $startX To $endX Step 1
    WinMove($hWnd, '', $i, Int($startY))
    Sleep($tpp)
    $startY += $stepY
    Next
    Case 8
    $startX = 0-($pos[2])
    $startY = 0-($pos[3]/2)
    $endX = $Left
    $endY = $Top
    $absX = $endX-$startX
    $absY = $endY+Abs($startY)
    $weg = Sqrt($absX^2 + $absY^2)
    $tpp = Int($Speed/$weg)
    $stepY = $absY/$absX
    For $i = $startX To $endX Step 1
    WinMove($hWnd, '', $i, $startY)
    Sleep($tpp)
    $startY += $stepY
    Next
    Case -1
    $startX = $pos[0]
    $tpp = Int($Speed/(@DesktopWidth-$startX))
    For $i = $startX To @DesktopWidth Step 1
    WinMove($hWnd, '', $i, $Top)
    Sleep($tpp)
    Next
    Case -2
    $startY = $pos[1]
    $tpp = Int($Speed/(@DesktopHeight-$startY))
    For $i = $startY To @DesktopHeight Step 1
    WinMove($hWnd, '', $Left, $i)
    Sleep($tpp)
    Next
    Case -3
    $startX = $pos[0]
    $startY = $pos[1]
    $endX = 0-$pos[2]
    $tpp = Int($Speed/($pos[2]+$startX))
    For $i = $startX To $endX Step -1
    WinMove($hWnd, '', $i, $Top)
    Sleep($tpp)
    Next
    Case -4
    $startX = $pos[0]
    $startY = $pos[1]
    $endY = 0-$pos[3]
    $tpp = Int($Speed/($pos[3]+$startY))
    For $i = $startY To $endY Step -1
    WinMove($hWnd, '', $Left, $i)
    Sleep($tpp)
    Next
    Case -5
    $startX = $pos[0]
    $startY = $pos[1]
    $endX = @DesktopWidth
    $endY = 0-$pos[3]/2
    $absX = $endX-$startX
    $absY = $startY+Abs($endY)
    $weg = Sqrt($absX^2 + $absY^2)
    $tpp = Int($Speed/$weg)
    $stepY = $absY/$absX
    For $i = $startX To $endX Step 1
    WinMove($hWnd, '', $i, Int($startY))
    Sleep($tpp)
    $startY -= $stepY
    Next
    Case -6
    $startX = $pos[0]
    $startY = $pos[1]
    $endX = @DesktopWidth
    $endY = @DesktopHeight-($pos[3]/2)
    $absX = $endX-$startX
    $absY = $endY-$startY
    $weg = Sqrt($absX^2 + $absY^2)
    $tpp = Int($Speed/$weg)
    $stepY = $absY/$absX
    For $i = $startX To $endX Step 1
    WinMove($hWnd, '', $i, Int($startY))
    Sleep($tpp)
    $startY += $stepY
    Next
    Case -7
    $startX = $pos[0]
    $startY = $pos[1]
    $endX = 0-$pos[2]
    $endY = @DesktopHeight-($pos[3]/2)
    $absX = $startX+Abs($endX)
    $absY = $endY-$startY
    $weg = Sqrt($absX^2 + $absY^2)
    $tpp = Int($Speed/$weg)
    $stepY = $absY/$absX
    For $i = $startX To $endX Step -1
    WinMove($hWnd, '', $i, Int($startY))
    Sleep($tpp)
    $startY += $stepY
    Next
    Case -8
    $startX = $pos[0]
    $startY = $pos[1]
    $endX = 0-$pos[2]
    $endY = 0-$pos[3]/2
    $absX = $startX+Abs($endX)
    $absY = $startY+Abs($endY)
    $weg = Sqrt($absX^2 + $absY^2)
    $tpp = Int($Speed/$weg)
    $stepY = $absY/$absX
    For $i = $startX To $endX Step -1
    WinMove($hWnd, '', $i, Int($startY))
    Sleep($tpp)
    $startY -= $stepY
    Next
    EndSwitch
    EndFunc ;==>_SlideWindow

    [/autoit]
    • Offizieller Beitrag

    Hallo!

    NAja, beim dllcall sieht es nochmal etwas anderes aus:

    Spoiler anzeigen
    [autoit]

    $hwnd = GUICreate ( "Blend test", 300, 300,0,-1)
    WinSetOnTop($hwnd,"",1)
    guisetbkcolor(0)
    DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001 );slide in from left
    Sleep(500)
    DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050002 );slide out to left
    Sleep(500)

    [/autoit]


    Dein udf ist super :)

    Mfg Spider