Jump to content

shake


Recommended Posts

Well explain what you want, adding an example code goes a long way to getting help faster.

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
$case = 1

$Form1 = GUICreate("Shake Me", 373, 264, 193, 115)
$shake = GUICtrlCreateButton("Shake me baby, shake me!", 88, 80, 187, 105, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $shake
            _ShakeGUI($Form1)
    EndSwitch
WEnd

Func _ShakeGUI($form, $duration = 1000)
    _WinAPI_FlashWindow ($form)
    $timer = TimerInit()
    $win = WinGetPos($form)
    Do
        Switch $case
            Case 1
                $x = $win[0] + 20
                $y = $win[1]
            Case 2
                $x = $win[0] + 20
                $y = $win[1] + 20
            Case 3
                $x = $win[0]
                $y = $win[1] + 20
            Case 4
                $x = $win[0]
                $y = $win[1]
        EndSwitch
        WinMove($form, "", $x, $y)
        $case += 1
        If $case = 5 Then $case = 1
        Until TimerDiff($timer) >= $duration
        WinMove($form, "", $win[0], $win[1])
EndFunc  ;==>_ShakeGUI
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...