Sign in to follow this  
Followers 0
mlloz

shake

5 posts in this topic

hello there..

is it possible to shake the form?

Share this post


Link to post
Share on other sites



yes..

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

sorry, I'm bit confused..

thanks alot. muttley

Share this post


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
Sign in to follow this  
Followers 0