Search the Community
Showing results for tags 'animatewindow'.
-
I created this to work with the constants of AnimateWindow and to animate the whole window and not just the client area. Please test and provide constructive feedback. #include <APISysConstants.au3> Example() Func Example() Local $hGUI = GUICreate('', 300, 200, @DesktopWidth - 320, @DesktopHeight - 270) _AnimateWindow($hGUI, $AW_HOR_NEGATIVE, 3) Sleep(1000) _AnimateWindow($hGUI, BitOR($AW_HOR_POSITIVE, $AW_HIDE), 2) EndFunc ;==>Example #cs $AW_ACTIVATE $AW_HIDE $AW_HOR_NEGATIVE $AW_HOR_POSITIVE $AW_VER_NEGATIVE $AW_VER_POSITIVE #ce Func _AnimateWindow($hWnd, $iFlags, $iSpeed = Default) Local $aWinGetPos = WinGetPos($hWnd) If Not @error Then Local Enum $WINGETPOS_XPOS, $WINGETPOS_YPOS, $WINGETPOS_WIDTH, $WINGETPOS_HEIGHT Local $iXAfter = $aWinGetPos[$WINGETPOS_XPOS], $iXBefore = $aWinGetPos[$WINGETPOS_XPOS], $iYAfter = $aWinGetPos[$WINGETPOS_YPOS], $iYBefore = $aWinGetPos[$WINGETPOS_YPOS] Local $fIsHide = BitAND($AW_HIDE, $iFlags) = $AW_HIDE If BitAND($AW_VER_POSITIVE, $iFlags) Then $iYAfter += $aWinGetPos[$WINGETPOS_HEIGHT] ElseIf BitAND($AW_VER_NEGATIVE, $iFlags) Then $iYBefore += $aWinGetPos[$WINGETPOS_HEIGHT] ElseIf BitAND($AW_HOR_POSITIVE, $iFlags) Then $iXAfter += $aWinGetPos[$WINGETPOS_WIDTH] ElseIf BitAND($AW_HOR_NEGATIVE, $iFlags) Then $iXBefore += $aWinGetPos[$WINGETPOS_WIDTH] EndIf If $iXBefore <> $iXAfter Or $iYBefore <> $iYAfter Then WinMove($hWnd, '', $iXBefore, $iYBefore, $aWinGetPos[$WINGETPOS_WIDTH], $aWinGetPos[$WINGETPOS_HEIGHT]) EndIf If Not $fIsHide Then GUISetState(((BitAND($AW_ACTIVATE, $iFlags) = $AW_ACTIVATE) ? @SW_SHOW : @SW_SHOWNOACTIVATE), $hWnd) EndIf If $iSpeed = Default Then $iSpeed = 5 WinMove($hWnd, '', $iXAfter, $iYAfter, $aWinGetPos[$WINGETPOS_WIDTH], $aWinGetPos[$WINGETPOS_HEIGHT], $iSpeed) If $fIsHide Then GUISetState(@SW_HIDE, $hWnd) EndIf EndIf EndFunc ;==>_AnimateWindow