Jump to content

Window Animations


Recommended Posts

The window animations here:

http://www.autoitscript.com/forum/index.ph...102entry84102

Are close to what I wanted for my toolbar I'm writing. However, with the $AW_SLIDE_OUT_LEFT will completely hide the window, and I want to simply slide/move it mostly off screen, with just a small portion showing:

Posted Image

Full tool bar:

Posted Image

Current Hide Code (workaround):

Func Hide()
    If $hide_state = 0 Then
        $a_pos = WinGetPos($main, "")
        Do
            $a_pos[0] = ($a_pos[0] - 1)
            WinMove($main, "", $a_pos[0], $a_pos[1])
        Until $a_pos[0] = -508
        $hide_state = 1
        GUICtrlSetData($Hide, ">")
    ElseIf $hide_state = 1 Then
        $a_pos = WinGetPos($main, "")
        Do
            $a_pos[0] = ($a_pos[0] + 1)
            WinMove($main, "", $a_pos[0], $a_pos[1])
        Until $a_pos[0] = 0
        $hide_state = 0
        GUICtrlSetData($Hide, "<")
    EndIf
EndFunc  ;==>Hide

Is there a better way of doing this? Perhaps, an API call that will simply move the window in a similar fashion to the AnimateWindows API calls?

If anyone can knows of something, let me know.

-Simucal

Full Proof of concept script:

#include <GUIConstants.au3>

Global $hide_state = 0

$main = GUICreate("Sliding Toolbar", 523, 85, 0, -1, -1, BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
$Button1 = GUICtrlCreateButton("Btn 1", 20, 35, 73, 41)
GUICtrlCreateLabel("Button 1", 28, 6, 60, 28, $SS_CENTER)
$Button2 = GUICtrlCreateButton("Btn 2", 100, 35, 73, 41)
GUICtrlCreateLabel("Button 2", 108, 6, 60, 28, $SS_CENTER)
$Button3 = GUICtrlCreateButton("Btn 3", 180, 35, 73, 41)
GUICtrlCreateLabel("Button 3", 194, 6, 43, 17)
$Button4 = GUICtrlCreateButton("Btn 4", 260, 35, 73, 41)
GUICtrlCreateLabel("Button 4", 280, 6, 75, 17)
$Button5 = GUICtrlCreateButton("Btn 5", 340, 35, 73, 41)
GUICtrlCreateLabel("Button 5", 350, 6, 75, 17)
$Button6 = GUICtrlCreateButton("Btn 6", 420, 35, 73, 41)
GUICtrlCreateLabel("Button 6", 436, 6, 40, 17)
$Hide = GUICtrlCreateButton("<", 505, 8, 17, 70, BitOR($BS_CENTER, $BS_FLAT))
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $main, "int", 500, "long", 0x00040001)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            Hide()
        Case $msg = $Button2
            Hide()
        Case $msg = $Button3
            Hide()
        Case $msg = $Button4
            Hide()
        Case $msg = $Button5
            Hide()
        Case $msg = $Hide
            Hide()
    EndSelect
WEnd
Exit

Func Hide()
;DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $main, "int", 500, "long", 0x00050002)
    If $hide_state = 0 Then
        $a_pos = WinGetPos($main, "")
        Do
            $a_pos[0] = ($a_pos[0] - 1)
            WinMove($main, "", $a_pos[0], $a_pos[1])
        Until $a_pos[0] = -508
        $hide_state = 1
        GUICtrlSetData($Hide, ">")
    ElseIf $hide_state = 1 Then
        $a_pos = WinGetPos($main, "")
        Do
            $a_pos[0] = ($a_pos[0] + 1)
            WinMove($main, "", $a_pos[0], $a_pos[1])
        Until $a_pos[0] = 0
        $hide_state = 0
        GUICtrlSetData($Hide, "<")
    EndIf
EndFunc  ;==>Hide
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

well this was the best i could do.. i used you system on *XPClean Menu*

here is a shot at it for ya

#include <GUIConstants.au3>

$hwnd2 = GUICreate("Sliding Toolbar", 523, 85, 0, 250, -1, BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
$Button1 = GUICtrlCreateButton("Btn 1", 20, 35, 73, 41)
GUICtrlCreateLabel("Button 1", 28, 6, 60, 28, $SS_CENTER)
$Button2 = GUICtrlCreateButton("Btn 2", 100, 35, 73, 41)
GUICtrlCreateLabel("Button 2", 108, 6, 60, 28, $SS_CENTER)
$Button3 = GUICtrlCreateButton("Btn 3", 180, 35, 73, 41)
GUICtrlCreateLabel("Button 3", 194, 6, 43, 17)
$Button4 = GUICtrlCreateButton("Btn 4", 260, 35, 73, 41)
GUICtrlCreateLabel("Button 4", 280, 6, 75, 17)
$Button5 = GUICtrlCreateButton("Btn 5", 340, 35, 73, 41)
GUICtrlCreateLabel("Button 5", 350, 6, 75, 17)
$Button6 = GUICtrlCreateButton("Btn 6", 420, 35, 73, 41)
GUICtrlCreateLabel("Button 6", 436, 6, 40, 17)
$Hide = GUICtrlCreateButton("<", 505, 8, 17, 70, BitOR($BS_CENTER, $BS_FLAT))
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 1000, "long", 0x00040001);slide in from left
GUISetState()
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 1000, "long", 0x00050002);slide out to left

$hwnd = GUICreate("Sliding Toolbar", 523, 85, -500, 250, -1, BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
$Show = GUICtrlCreateButton(">", 505, 8, 17, 70, BitOR($BS_CENTER, $BS_FLAT))
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001);slide in from left
GUISetState()

WinSetOnTop($hwnd, "", 1)

While 1
    
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then Exit
    
    If $msg = $Show Then Slide_in()
    
    If $msg = $Hide Then Slide_out()
    
    Sleep(10)
WEnd

Func Slide_in()
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050002);slide out to left
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 1000, "long", 0x00040001);slide in from left
EndFunc  ;==>Slide_in

Func Slide_out()
    WinMove($hwnd, "", -500, 250)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 1000, "long", 0x00050002);slide out to left
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001);slide in from left
EndFunc  ;==>Slide_out

********** move the windows to different locations... its kinda neet

8)

NEWHeader1.png

Link to comment
Share on other sites

Thanks val, that was a good idea. After a little tweaking I got it to look pretty much how I wanted it:

#include <GUIConstants.au3>
$hwnd = GUICreate("Sliding Toolbar", 523, 85, -528, 250, -1, BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
$Show = GUICtrlCreateButton(">", 505, 8, 17, 70, BitOR($BS_CENTER, $BS_FLAT))
GuiSetState()

$hwnd2 = GUICreate("Sliding Toolbar", 523, 85, 0, 250, -1, BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
$Button1 = GUICtrlCreateButton("Btn 1", 20, 35, 73, 41)
GUICtrlCreateLabel("Button 1", 28, 6, 60, 28, $SS_CENTER)
$Button2 = GUICtrlCreateButton("Btn 2", 100, 35, 73, 41)
GUICtrlCreateLabel("Button 2", 108, 6, 60, 28, $SS_CENTER)
$Button3 = GUICtrlCreateButton("Btn 3", 180, 35, 73, 41)
GUICtrlCreateLabel("Button 3", 194, 6, 43, 17)
$Button4 = GUICtrlCreateButton("Btn 4", 260, 35, 73, 41)
GUICtrlCreateLabel("Button 4", 280, 6, 75, 17)
$Button5 = GUICtrlCreateButton("Btn 5", 340, 35, 73, 41)
GUICtrlCreateLabel("Button 5", 350, 6, 75, 17)
$Button6 = GUICtrlCreateButton("Btn 6", 420, 35, 73, 41)
GUICtrlCreateLabel("Button 6", 436, 6, 40, 17)
$Hide = GUICtrlCreateButton("<", 505, 8, 17, 70, BitOR($BS_CENTER, $BS_FLAT))





While 1
    
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then Exit
    
    If $msg = $Show Then Slide_in()
    
    If $msg = $Hide Then Slide_out()
    
    Sleep(10)
WEnd

Func Slide_in()

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 0, "long", 0x00050002);slide out to left
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 500, "long", 0x00040001);slide in from left
        WinActivate($hwnd2)
    WinWaitActive($hwnd2)
EndFunc ;==>Slide_in

Func Slide_out()
    WinMove($hwnd, "", -500, 250)

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2, "int", 500, "long", 0x00050002);slide out to left
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 0, "long", 0x00040001);slide in from left
            WinActivate($hwnd)
    WinWaitActive($hwnd)
EndFunc ;==>Slide_out
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
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...