LiquidNitrogen Posted January 31, 2012 Share Posted January 31, 2012 (edited) This UDF i Created gives a Control an Animated Entrance. expandcollapse popup; #FUNCTION# ========================================================================== ; Function......: AnimateControl($hWnd, $iHandle [,$iAnimate [,$iSpeed]]) ; Author........: ReaperX ; Description...: Gives a Control an Animated Entrance. ; $hWnd -> Handle to the Current GUI Window ; $iHandle -> Handle to the Control to Animate ; $iAnimate -> Entrance Animation to Use. Options: ; 1 = Slide in from left (Default) ; 2 = Slide in from right ; 3 = Slide in from top ; 4 = Slide in from bottom ; $iSpeed -> Speed of the Entrance. Options: ; 0 = Fast ; 1 = Slow (Default) ; @Error -> -1 = Invalid Parameter for $iAnimate ; -2 = Invalid Parameter for $iSpeed ; ====================================================================================== Func AnimateControl($hWnd, $iHandle, $iAnimate = 1, $iSpeed = 1) Local $iPos, $iWinSize If $iAnimate > 4 Or $iAnimate < 1 Or Not StringIsAlNum($iAnimate) Then SetError(-1) ConsoleWrite("Invalid Parameter for $iAnimate in _WinAPI_AnimateControl()." & @CRLF) Exit EndIf If $iSpeed > 1 Or $iSpeed < 0 Or Not StringIsAlNum($iSpeed) Then SetError(-2) ConsoleWrite("Invalid Parameter for $iSpeed in _WinAPI_AnimateControl()." & @CRLF) Exit EndIf GUISetState() $iPos = ControlGetPos(WinGetTitle($hWnd), "", $iHandle) $iWinSize = WinGetClientSize(WinGetTitle($hWnd)) ;Slide in from Left If $iAnimate = 1 Then For $i = -40 To $iPos[0] GUICtrlSetPos($iHandle, $i, $iPos[1]) Sleep($iSpeed) Next Return EndIf ;Slide in from Right If $iAnimate = 2 Then For $i = $iWinSize[0] To $iPos[0] Step -1 GUICtrlSetPos($iHandle, $i, $iPos[1]) Sleep($iSpeed) Next Return EndIf ;Slide in from Top If $iAnimate = 3 Then For $i = 0 To $iPos[1] GUICtrlSetPos($iHandle, $iPos[0], $i) Sleep($iSpeed) Next Return EndIf ;Slide in from Bottom If $iAnimate = 4 Then For $i = $iWinSize[1] + 30 To $iPos[1] Step -1 GUICtrlSetPos($iHandle, $iPos[0], $i) Sleep($iSpeed) Next Return EndIf EndFunc ;==>AnimateControl Edited January 31, 2012 by ReaperX Formerly ReaperX Link to comment Share on other sites More sharing options...
Mat Posted January 31, 2012 Share Posted January 31, 2012 Just for the record, _WinAPI_* functions wrap the WINdows API... This is going to create some confusion with the actual winapi function AnimateWindow. If you search the forum I'm sure you'll find examples of using that function. AutoIt Project Listing Link to comment Share on other sites More sharing options...
JScript Posted January 31, 2012 Share Posted January 31, 2012 Cool, but why _WinAPI ?!João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
LiquidNitrogen Posted January 31, 2012 Author Share Posted January 31, 2012 (edited) Yeah... I dont know why i chose _WinAPI. Sorry. I Changed it. Edited January 31, 2012 by ReaperX Formerly ReaperX Link to comment Share on other sites More sharing options...
salim Posted July 11, 2012 Share Posted July 11, 2012 ReaperX Can U give me Sample from U'r UDF ..?? I New In AutoIt. I want Learn for everything in AutoIt.. Thank's.. Link to comment Share on other sites More sharing options...
PhoenixXL Posted July 11, 2012 Share Posted July 11, 2012 (edited) not working as expectedexpandcollapse popup#include <GUIConstantsEx.au3> Opt( "TrayIconDebug", 1 ) $hWin = GUICreate(@ScriptName) $iLbl = GUICtrlCreateLabel('This is a Test', 10, 10) GUICtrlSetState( -1, $GUI_HIDE ) GUISetState() AnimateControl($hWin, $iLbl, 4, 100) While GUIGetMsg() <> -3 Sleep(10) WEnd ; #FUNCTION# ========================================================================== ; Function......: AnimateControl($hWnd, $iHandle [,$iAnimate [,$iSpeed]]) ; Author........: ReaperX/ Modified - Phoenix XL ; Description...: Gives a Control an Animated Entrance. ; $hWnd -> Handle to the Current GUI Window ; $iHandle -> Handle to the Control to Animate ; $iAnimate -> Entrance Animation to Use. Options: ; 1 = Slide in from left (Default) ; 2 = Slide in from right ; 3 = Slide in from top ; 4 = Slide in from bottom ; $iSpeed -> Speed of the Entrance. Any number use as required ; @Error -> -1 = Invalid Parameter for $iAnimate ; -2 = Invalid Parameter for $iSpeed ; ====================================================================================== Func AnimateControl($hWnd, $iHandle, $iAnimate = 1, $iSpeed = 1) Local $iPos, $iWinSize If $iAnimate > 4 Or $iAnimate < 1 Or Not StringIsAlNum($iAnimate) Then SetError(-1) ConsoleWrite("Invalid Parameter for $iAnimate in _WinAPI_AnimateControl()." & @CRLF) Return EndIf If $iSpeed < 0 Or Not IsNumber($iSpeed) Then SetError(-2) ConsoleWrite("Invalid Parameter for $iSpeed in _WinAPI_AnimateControl()." & @CRLF) Return EndIf ;GUISetState() $iPos = ControlGetPos($hWnd, "", $iHandle) $iWinSize = WinGetClientSize(WinGetTitle($hWnd)) ;Slide in from Left If $iAnimate = 1 Then GUICtrlSetPos($iHandle, -40, $iPos[1]) GUICtrlSetState( $iHandle, $GUI_SHOW ) For $i = -40 To $iPos[0] GUICtrlSetPos($iHandle, $i, $iPos[1]) Sleep((1 / $iSpeed) * 30) Next Return EndIf ;Slide in from Right If $iAnimate = 2 Then GUICtrlSetPos($iHandle, $iWinSize[0], $iPos[1]) GUICtrlSetState( $iHandle, $GUI_SHOW ) For $i = $iWinSize[0] To $iPos[0] Step -1 GUICtrlSetPos($iHandle, $i, $iPos[1]) Sleep((1 / $iSpeed) * 30) Next Return EndIf ;Slide in from Top If $iAnimate = 3 Then GUICtrlSetPos($iHandle, $iPos[0], 0) GUICtrlSetState( $iHandle, $GUI_SHOW ) For $i = 0 To $iPos[1] GUICtrlSetPos($iHandle, $iPos[0], $i) Sleep((1 / $iSpeed) * 30) Next Return EndIf ;Slide in from Bottom If $iAnimate = 4 Then GUICtrlSetPos($iHandle, $iPos[0], $iWinSize[1] + 30) GUICtrlSetState( $iHandle, $GUI_SHOW ) For $i = $iWinSize[1] + 30 To $iPos[1] Step -1 GUICtrlSetPos($iHandle, $iPos[0], $i) Sleep((1 / $iSpeed) * 30) Next Return EndIf EndFunc ;==>AnimateControl Edited March 8, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
salim Posted July 12, 2012 Share Posted July 12, 2012 not working as expected Thank's PhoenixXL Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now