or...
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;~ gone to
;~ https://www.autoitscript.com/wiki/Snippets_(_GUI_)#Animate_Display
;~ for simplicity
Global $g_hGui, $g_aGuiPos, $g_hPic, $g_aPicPos, $trans = 0, $iPic, $hPic
Example()
Func Example()
$g_hGui = GUICreate("test Animate Display", 200, 100)
WinSetTrans($g_hGui, "", 150) ; i know, not needed.
$g_hPic = GUICreate("", 68, 71, 10, 20, $WS_POPUp, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $g_hGui)
$iPic = GUICtrlCreatePic(StringLeft(@AutoItExe,StringInStr(@AutoItExe,"\", 0, -1)) & "Examples\GUI\merlin.gif",0,0,0,0)
$hPic = GUICtrlGetHandle($iPic)
GUISetState(@SW_SHOW, $g_hPic)
GUISetState(@SW_SHOW, $g_hGui)
HotKeySet("{ESC}", "Main")
HotKeySet("{Left}", "Left")
HotKeySet("{Right}", "Right")
HotKeySet("{Down}", "Down")
HotKeySet("{Up}", "Up")
HotKeySet("{PGUP}", "TransUp")
HotKeySet("{PGDN}", "TransDown")
$g_aPicPos = WinGetPos($g_hPic)
$g_aGuiPos = WinGetPos($g_hGui)
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete($g_hPic)
GUIDelete($g_hGui)
ExitLoop
EndSwitch
WEnd
HotKeySet("{ESC}")
HotKeySet("{Left}")
HotKeySet("{Right}")
HotKeySet("{Down}")
HotKeySet("{Up}")
EndFunc ;==>Example
Func Main()
$g_aGuiPos = WinGetPos($g_hGui)
WinMove($g_hGui, "", $g_aGuiPos[0] + 10, $g_aGuiPos[1] + 10)
EndFunc ;==>Main
Func Left()
$g_aPicPos = WinGetPos($g_hPic)
WinMove($g_hPic, "", $g_aPicPos[0] - 10, $g_aPicPos[1])
EndFunc ;==>Left
Func Right()
$g_aPicPos = WinGetPos($g_hPic)
WinMove($g_hPic, "", $g_aPicPos[0] + 10, $g_aPicPos[1])
EndFunc ;==>Right
Func Down()
$g_aPicPos = WinGetPos($g_hPic)
WinMove($g_hPic, "", $g_aPicPos[0], $g_aPicPos[1] + 10)
EndFunc ;==>Down
Func Up()
$g_aPicPos = WinGetPos($g_hPic)
WinMove($g_hPic, "", $g_aPicPos[0], $g_aPicPos[1] - 10)
EndFunc ;==>Up
Func TransUp()
;~ $trans -= 15
;~ If $trans < 15 Then $trans = 15
;~ If $trans > 255 Then $trans = 255
;~ WinSetTrans($g_hPic, "", $trans)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $g_hPic, "int", 1000, "long", 0x00050010) ; fade-in
EndFunc
Func TransDown()
;~ $trans += 15
;~ If $trans < 0 Then $trans = 0
;~ If $trans > 255 Then $trans = 255
;~ WinSetTrans($g_hPic, "", $trans)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $g_hPic, "int", 1000, "long", 0x00040010) ; fade-out
EndFunc