Jump to content

Set Image Flicker Help


Lecdev
 Share

Recommended Posts

If anybody has a bright idea (aside from slowing down the image update) on how to stop the intermittent flickering on this little bit of test gui code i'd love to hear it, my icon dll (icl) is attached

 

GUICreate("Preloader Test", 296, 296)
Global $sFile = "Preloader.dll"
Global $nCounter = 1
Global $sIconName = "image" & String($nCounter)
Global $hIcon = GUICtrlCreateIcon($sFile,$sIconName,20,20,256,256)
GUISetState(@SW_SHOW)
Local $gMsg

AdlibRegister ( "_SpinPreloader", 50)
Do
    Sleep(10)
    ; do loop searching/loading
Until GUIGetMsg() = -3
AdlibUnRegister("_SpinPreloader")
Exit

Func _SpinPreloader()
    $nCounter += 1
    If $nCounter = 9 Then $nCounter = 1
    $sIconName = "image" & String($nCounter)
    GUICtrlSetImage($hIcon,$sFile,$sIconName)
EndFunc

Preloader.dll

Link to comment
Share on other sites

You can use GDIPlus to animate the icons:

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <WinAPIShellEx.au3>

_GDIPlus_Startup()
GUICreate("Preloader Test", 296, 296)
Global $sFile = "Preloader.dll"
Global $nCounter = 1
Global $sIconName = "image" & String($nCounter)
Global $hGUI = GUICreate("Test", 256, 256, -1, -1, $WS_POPUP)
GUISetBkColor(0x404040)
GUISetState(@SW_SHOW)
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $aIcons[8], $i, $t
For $i = 0 To 7
    $t = _WinAPI_ShellExtractIcon(@ScriptDir & "\" & $sFile, $i, 256, 256)
    $aIcons[$i] = _GDIPlus_BitmapCreateFromHICON32($t)
    _WinAPI_DestroyIcon($t)
Next
AdlibRegister("_SpinPreloader", 60)

Do
;~  Sleep(100)
    ; do loop searching/loading
Until GUIGetMsg() = -3

AdlibUnRegister("_SpinPreloader")
_GDIPlus_GraphicsDispose($hGraphic)
For $i = 0 To 7
    _GDIPlus_BitmapDispose($aIcons[$i])
Next
_GDIPlus_Shutdown()

Exit

Func _SpinPreloader()
    Local Static $j = 0
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $aIcons[Mod($j, 8)], 0, 0, 256, 256)
    $j += 1
EndFunc   ;==>_SpinPreloader

 

Have a look to https://www.autoitscript.com/forum/topic/150545-gdi-animated-loading-screens-build-2014-06-20-32-examples for some real time calculated animated waiting screens.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Moderators

Why are you posting the same question in multiple forums? Please stick to one place only.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13 i put it in general by accident meaning to put it in gui help, reposted it in the correct place and then couldnt delete the first one... my bad haha

 

UEZ thanks for that i will be using gdi plus in the full script im writing anyway to draw graphs so that looks like the way to go.

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...