Hello all, I'm trying to make a loading screen using gdi and a udf made by UEZ, the script should open a window and display the specified gif (download here: https://d13yacurqjgara.cloudfront.net/users/90627/screenshots/1096260/loading.gif )
But instead it throws an error when accessing the array of frames, so I'm missing something here.
script:
AutoIt
#include <gdiplus.au3> #include <_GDIPlus_GIFAnim.au3> #include <WindowsConstants.au3> #include <memory.au3> _loadinggui() while 1 sleep(10) WEnd Func _loadinggui() Global Const $hGIFAnim3 = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Images\loading.gif") Global Const $iW3 = _GDIPlus_ImageGetWidth($hGIFAnim3), $iH3 = _GDIPlus_ImageGetHeight($hGIFAnim3) Global $loading = GUICreate("Secure Instant Messenger (SIM) - Login", $iW3, $iH3), $iPosX = 10, $iPosY = 285 GUISetBkColor(0x000000, $loading) Global $hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($loading) Global $iAnim3CurrentFrame = 0 Global Const $iAnim3DimCount = _GDIPlus_GIFAnimGetFrameDimensionsCount($hGIFAnim3) Global Const $tAnim3GUID = _GDIPlus_GIFAnimGetFrameDimensionsList($hGIFAnim3, $iAnim3DimCount) Global Const $iAnim3FrameCount = _GDIPlus_GIFAnimGetFrameCount($hGIFAnim3, $tAnim3GUID) Global Const $aAnim3FrameDelays = _GDIPlus_GIFAnimGetFrameDelays($hGIFAnim3, $iAnim3FrameCount) GUIRegisterMsg($WM_TIMER, "PlayAnimPreview2") DllCall("user32.dll", "int", "SetTimer", "hwnd", $loading, "int", 0, "int", 100, "int", 0) GUISetState() EndFunc func PlayAnimPreview2() Local $hBmp2 = _GDIPlus_BitmapCreateFromScan0($iW3, $iH3) Local $hGfx2 = _GDIPlus_ImageGetGraphicsContext($hBmp2) _GDIPlus_GraphicsDrawImageRect($hGraphic2, $hBmp2, 0, 0, $iW3, $iH3) _GDIPlus_GraphicsDispose($hGfx2) _GDIPlus_BitmapDispose($hBmp2) Anim3($hGfx2) EndFunc Func Anim3(ByRef $hGfx) Local $iDelayAnim3 = $aAnim3FrameDelays[$iAnim3CurrentFrame] Local Static $iTimerCurrentFrame = TimerInit() _GDIPlus_GIFAnimSelectActiveFrame($hGIFAnim3, $tAnim3GUID, $iAnim3CurrentFrame) _GDIPlus_GraphicsDrawImageRect($hGfx, $hGIFAnim3, 20, 5, $iW3, $iH3) If TimerDiff($iTimerCurrentFrame) > $iDelayAnim3 Then $iAnim3CurrentFrame += 1 $iTimerCurrentFrame = TimerInit() EndIf If $iAnim3CurrentFrame > UBound($aAnim3FrameDelays) - 1 Then $iAnim3CurrentFrame = 0 EndFunc ;==>Anim3
I feel like I'm missing something incredibly simple...