Jump to content

Recommended Posts

Hola Scripters

I wanted to contribute with my AnimateWindow UDF.

I like the AnimateWindow DLLCall, cause it makes my scripts look :(

You need a Beta wich supports DLLCall to use it.

;CONSTANTS
Global Const $AW_FADE_IN = 0x00080000;fade-in
Global Const $AW_FADE_OUT = 0x00090000;fade-out
Global Const $AW_SLIDE_IN_LEFT = 0x00040001;slide in from left
Global Const $AW_SLIDE_OUT_LEFT = 0x00050002;slide out to left
Global Const $AW_SLIDE_IN_RIGHT = 0x00040002;slide in from right
Global Const $AW_SLIDE_OUT_RIGHT = 0x00050001;slide out to right
Global Const $AW_SLIDE_IN_TOP = 0x00040004;slide-in from top
Global Const $AW_SLIDE_OUT_TOP = 0x00050008;slide-out to top
Global Const $AW_SLIDE_IN_BOTTOM = 0x00040008;slide-in from bottom
Global Const $AW_SLIDE_OUT_BOTTOM = 0x00050004;slide-out to bottom
Global Const $AW_DIAG_SLIDE_IN_TOPLEFT = 0x00040005;diag slide-in from Top-left
Global Const $AW_DIAG_SLIDE_OUT_TOPLEFT = 0x0005000a;diag slide-out to Top-left
Global Const $AW_DIAG_SLIDE_IN_TOPRIGHT = 0x00040006;diag slide-in from Top-Right
Global Const $AW_DIAG_SLIDE_OUT_TOPRIGHT = 0x00050009;diag slide-out to Top-Right
Global Const $AW_DIAG_SLIDE_IN_BOTTOMLEFT = 0x00040009;diag slide-in from Bottom-left
Global Const $AW_DIAG_SLIDE_OUT_BOTTOMLEFT = 0x00050006;diag slide-out to Bottom-left
Global Const $AW_DIAG_SLIDE_IN_BOTTOMRIGHT = 0x0004000a;diag slide-in from Bottom-right
Global Const $AW_DIAG_SLIDE_OUT_BOTTOMRIGHT = 0x00050005;diag slide-out to Bottom-right
Global Const $AW_EXPLODE = 0x00040010;explode
Global Const $AW_IMPLODE = 0x00050010;implode

Func _WinAnimate($v_gui, $i_mode, $i_duration = 1000)
    If @OSVersion = "WIN_XP" OR @OSVersion = "WIN_2000" Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($v_gui), "int", $i_duration, "long", $i_mode)
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            SetError(1)
            Return 0
        EndIf
        Return 1
    EndIf
EndFunc;==> _WinAnimate()

#cs DEMO - For lazy guys like me - to copy paste
    $hwnd = GUICreate("AnimateWindow - Demo", 300, 300)
    _WinAnimate($hwnd, $AW_FADE_IN)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_FADE_OUT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_IN_LEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_OUT_LEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_IN_RIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_OUT_RIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_IN_TOP)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_OUT_TOP)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_IN_BOTTOM)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_OUT_BOTTOM)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_IN_TOPLEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_OUT_TOPLEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_IN_TOPRIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_OUT_TOPRIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_IN_BOTTOMLEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_OUT_BOTTOMLEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_IN_BOTTOMRIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_OUT_BOTTOMRIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_EXPLODE)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_IMPLODE)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
#ce

Copy it to the Include directory of your AutoIt installation.

Include it to your script like this:

#Include <_WinAnimate.au3>

Then you can call the function like this:

_WinAnimate($gui,$mode[,$duration])

Parameters:

Where $gui is a valid GUI/WindowHandle or Title created by GUICreate or from WinGetHandle() or just a Titlename.

$mode is one of the following:

$AW_FADE_IN ;fade-in

$AW_FADE_OUT ;fade-out

$AW_SLIDE_IN_LEFT ;slide in from left

$AW_SLIDE_OUT_LEFT ;slide out to left

$AW_SLIDE_IN_RIGHT ;slide in from right

$AW_SLIDE_OUT_RIGHT ;slide out to right

$AW_SLIDE_IN_TOP ;slide-in from top

$AW_SLIDE_OUT_TOP ;slide-out to top

$AW_SLIDE_IN_BOTTOM ;slide-in from bottom

$AW_SLIDE_OUT_BOTTOM ;slide-out to bottom

$AW_DIAG_SLIDE_IN_TOPLEFT ;diag slide-in from Top-left

$AW_DIAG_SLIDE_OUT_TOPLEFT ;diag slide-out to Top-left

$AW_DIAG_SLIDE_IN_TOPRIGHT ;diag slide-in from Top-Right

$AW_DIAG_SLIDE_OUT_TOPRIGHT ;diag slide-out to Top-Right

$AW_DIAG_SLIDE_IN_BOTTOMLEFT ;diag slide-in from Bottom-left

$AW_DIAG_SLIDE_OUT_BOTTOMLEFT ;diag slide-out to Bottom-left

$AW_DIAG_SLIDE_IN_BOTTOMRIGHT ;diag slide-in from Bottom-right

$AW_DIAG_SLIDE_OUT_BOTTOMRIGHT ;diag slide-out to Bottom-right

$AW_EXPLODE ;explode

$AW_IMPLODE ;implode

$duration is the duration in miliseconds which the animation should last. The lower the duration, the faster is the animation. $duration is optional.

Edit: Updated the UDF-code of the first post (I hate to scroll down to search for the most actual version)

Edited by Raindancer
Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer
Link to post
Share on other sites

Very nice layout.

Have you looked into the concept of how a borderless window can slide out of a parent window? This would be a nice trick. If you have a nVidia control panel, the settings window, slides out. This example works from the centre only.

Link to post
Share on other sites

pretty sweet. keep it up.

changed:

function name to _WinAnimate.

added:

real consts.

some error handeling.

made it accept both Titles & Handels.

_WinAnimate.au3

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to post
Share on other sites

Very nice layout.

Have you looked into the concept of how a borderless window can slide out of a parent window? This would be a nice trick. If you have a nVidia control panel, the settings window, slides out. This example works from the centre only.

<{POST_SNAPBACK}>

Where abouts in the nVidia Control Panel? I can't find it.

Did you mean something like this? Excuse the lameness/messiness I done it in a rush lol.

#include <GUIConstants.au3>

$gui = GUICreate("My GUI", 200, 200, 20, 20)
$btn = GUICtrlCreateButton("Show", 10, 10)
GUISetState (@SW_SHOW)  ; will display an empty dialog box

$child = GUICreate("My GUI child", 100, 200, 225, 20, -1, -1, $gui)
GUISetState (@SW_HIDE)  ; will display an empty dialog box


While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then 
        DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $child, "int", 500, "long", 0x00050002 );slide out to left
    EndIf
    If $msg = $btn Then
       DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $child , "int", 500, "long", 0x00040001 );slide in from left
    EndIf
Wend
Edited by Burrup

qq

Link to post
Share on other sites

Where abouts in the nVidia Control Panel? I can't find it.

Did you mean something like this? Excuse the lameness/messiness I done it in a rush lol.

<{POST_SNAPBACK}>

Display properties -> Settings -> Advanced

Yes, your example looks like it. Just needs alittle fix, to keep it attached to the parent.

Thanks Burrup.

Link to post
Share on other sites

Display properties -> Settings -> Advanced

Yes, your example looks like it. Just needs alittle fix, to keep it attached to the parent.

Thanks Burrup.

<{POST_SNAPBACK}>

I see it now, nice... They really know how to make something like good and hi-tech and all those words.

qq

Link to post
Share on other sites

I found out, that those AnimatWindow functions only work with Windows XP.

So I modifyed the code, so that it calls the function only if the macro @OSVersion is "WIN_XP"

;CONSTANTS
Global Const $AW_FADE_IN = 0x00080000;fade-in
Global Const $AW_FADE_OUT = 0x00090000;fade-out
Global Const $AW_SLIDE_IN_LEFT = 0x00040001;slide in from left
Global Const $AW_SLIDE_OUT_LEFT = 0x00050002;slide out to left
Global Const $AW_SLIDE_IN_RIGHT = 0x00040002;slide in from right
Global Const $AW_SLIDE_OUT_RIGHT = 0x00050001;slide out to right
Global Const $AW_SLIDE_IN_TOP = 0x00040004;slide-in from top
Global Const $AW_SLIDE_OUT_TOP = 0x00050008;slide-out to top
Global Const $AW_SLIDE_IN_BOTTOM = 0x00040008;slide-in from bottom
Global Const $AW_SLIDE_OUT_BOTTOM = 0x00050004;slide-out to bottom
Global Const $AW_DIAG_SLIDE_IN_TOPLEFT = 0x00040005;diag slide-in from Top-left
Global Const $AW_DIAG_SLIDE_OUT_TOPLEFT = 0x0005000a;diag slide-out to Top-left
Global Const $AW_DIAG_SLIDE_IN_TOPRIGHT = 0x00040006;diag slide-in from Top-Right
Global Const $AW_DIAG_SLIDE_OUT_TOPRIGHT = 0x00050009;diag slide-out to Top-Right
Global Const $AW_DIAG_SLIDE_IN_BOTTOMLEFT = 0x00040009;diag slide-in from Bottom-left
Global Const $AW_DIAG_SLIDE_OUT_BOTTOMLEFT = 0x00050006;diag slide-out to Bottom-left
Global Const $AW_DIAG_SLIDE_IN_BOTTOMRIGHT = 0x0004000a;diag slide-in from Bottom-right
Global Const $AW_DIAG_SLIDE_OUT_BOTTOMRIGHT = 0x00050005;diag slide-out to Bottom-right
Global Const $AW_EXPLODE = 0x00040010;explode
Global Const $AW_IMPLODE = 0x00050010;implode

Func _WinAnimate($v_gui, $i_mode, $i_duration = 1000)
    If @OSVersion = "WIN_XP" Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($v_gui), "int", $i_duration, "long", $i_mode)
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            SetError(1)
            Return 0
        EndIf
        Return 1
    EndIf
EndFunc;==> _WinAnimate()

#cs DEMO - For lazy guys like me - to copy paste
    $hwnd = GUICreate("AnimateWindow - Demo", 300, 300)
    _WinAnimate($hwnd, $AW_FADE_IN)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_FADE_OUT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_IN_LEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_OUT_LEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_IN_RIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_OUT_RIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_IN_TOP)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_OUT_TOP)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_IN_BOTTOM)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_SLIDE_OUT_BOTTOM)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_IN_TOPLEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_OUT_TOPLEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_IN_TOPRIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_OUT_TOPRIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_IN_BOTTOMLEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_OUT_BOTTOMLEFT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_IN_BOTTOMRIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_DIAG_SLIDE_OUT_BOTTOMRIGHT)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_EXPLODE)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
    Sleep(1500)
    _WinAnimate($hwnd, $AW_IMPLODE)
    ConsoleWrite('er: ' & @error & @LF & 'ex: ' & @extended & @CRLF)
#ce
Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer
Link to post
Share on other sites
  • 2 months later...

Hi,

I like this UDF and I want to use it for a script of mine.

Works great except I have a minor visual question......

The GUI now has little black corners (see picture attachment)

Is there a way to get rid of them? Would visually be more nifty.

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...