Jump to content
Sign in to follow this  
Michel Claveau

Animated GIF (pure Autoit) example

Recommended Posts

Michel Claveau

Hi!

This example use IE (embbed) & window "layer" for on screen transparence.

BUT: it run only with Vista (& WS-2008). For old OS (like W2K or XP), see, with GIF89.DLL:

http://www.autoitscript.com/forum/index.php?showtopic=73743

#NoTrayIcon
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <IE.au3>

$choix=Random(1,4,1)

If $choix=1 Then
    $w = 98
    $h = 116
    $gif = "ysport184.gif"
    $pas = 2
    $vert = 235
    $delai = 12
    $debut = -$w
    $fin = @DesktopWidth+1
EndIf

If $choix=2 Then
    $w = 130
    $h = 70
    $gif = "ani20.gif"
    $pas = 1
    $vert = 280
    $delai = 12
    $debut = -$w
    $fin = @DesktopWidth+1
EndIf

If $choix=3 Then
    $w = 139
    $h = 108
    $gif = "1bateau.gif"
    $pas = -1
    $vert = 120
    $delai = 16
    $debut = @DesktopWidth+1
    $fin = -$w
EndIf

If $choix=4 Then
    $w = 400
    $h = 125
    $gif = "ponx2b.gif"
    $pas = 2
    $vert = 400
    $delai = 12
    $debut = -$w
    $fin = @DesktopWidth+1
EndIf

$HWnd = GUICreate("GIFanime", $w, $h, $debut, $vert, $WS_POPUP,$WS_EX_LAYERED)
$hgr=GUICtrlCreatePic("", -5,-5, $w+10, $h+10, $SS_SUNKEN)
$oIE=_IECreateEmbedded()
$GUIActiveX=GUICtrlCreateObj($oIE, -5, -5, $w+10, $h+10)

$stmp='file:///'& @ScriptDir &'\mini.htm'

_IENavigate($oIE, $stmp)
$oBody = _IETagNameGetCollection($oIE, "body", 0)
$stmp = '<HTML><BODY scroll=no><P><IMG src="'& @ScriptDir &'\'& $gif &'"></P></BODY></HTML>'
_IEDocInsertHTML($oBody, $stmp, "afterbegin")
GUISetState()

$n=$debut
$flag = True
$nb = int((@DesktopWidth+$w)/abs($pas))+1
For $i=1 To $nb
    $n += $pas
    WinMove($HWnd,"",$n,$vert)
    Sleep($delai)
Next
$obj = 0
Exit

This example need five files (4 GIF & 1 Html). These file included (with fileinstall) in attachment (pessai.exe)

Prior, download it, and run it.

Then you can use the source, IN THE SAME Dir.

Have good fun...

pessai.exe

Edited by Michel Claveau

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  

×