Jump to content

Yet another GIF display


taietel
 Share

Recommended Posts

It's not compared with Trancexx's, but it works for me. The example resizes with the gui:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate("Yet Another Gif Example", 250, 400, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME))
;create the object
$oObj = ObjCreate("Shell.Explorer.2")
$oObj_ctrl = GUICtrlCreateObj($oObj, 5, 5, 240, 390)
;resize control when the window resizes
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
;restrict right click
GUICtrlSetState(-1,$GUI_DISABLE)
;replace this with your own (from local hdd, web, ...):
$sGIF = @ScriptDir&"\Dance.gif"
;show the image
$URL = "about:<html><body bgcolor='#efefef' scroll='no'><img src='"&$sGIF&"' width='90%' height='100%' border='0'></img></body></html>"
$oObj.Navigate($URL)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            $oObj=0 ;destroy object...
            Exit
    EndSwitch
WEnd
Link to comment
Share on other sites

  • Replies 47
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Depending on the .GIF, it only consumes CPU...

I had already done a code, but in some GIFs, the consumption of CPU is greatly exaggerated!

#include-once
; #INDEX# =======================================================================================================================
; Title .........: _GUIResourcePic
; AutoIt Version.: 3.2.12++
; Language.......: English
; Description ...: Load image (.bmp, .jpg, .png, .gif {animated} and other formats.) resources from .exe, .dll, .ocx, .cpl...
; Author ........: João Carlos (jscript)
; ===============================================================================================================================

; #CURRENT# =====================================================================================================================
;_GUICtrlPic_Create
;_GUICtrlPic_Delete
;_GUICtrlPic_SetResizing
;_GUICtrlPic_SetState
;_GUICtrlPic_SetPos
;_GUICtrlPic_GetPos
;_GUICtrlPic_SetImage
; ===============================================================================================================================

; #INTERNAL_USE_ONLY#============================================================================================================
;_GUICtrlPic_GetSysColor
;==============================================================================================================================

; #VARIABLES# ===================================================================================================================
;Global Const $RT_BITMAP = 2
;Global Const $RT_STRING = 6
;Global Const $RT_RCDATA = 10
;Global Const $RT_MESSAGETABLE = 11
;Global Const $RT_ANICURSOR = 21
;Global Const $RT_ANIICON = 22
;Global Const $RT_HTML = 23
Global $aGRP_OBJECTID[1][5]
; ===============================================================================================================================

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlPic_Create
; Description ...: Creates a Picture control for the GUI.
; Syntax.........: _GUICtrlPic_Create( FileName, [ ResName [, Left [, Top [, Width [, Height [, ResType [, SetBkColor [, Border ]]]]]]]] )
; Parameters ....: FileName     - Filename of the picture or resource to be loaded, supported types: BMP, JPG, PNG, GIF(animated).
;                                 Can be an URL path too.
;                  ResName      - [optional] The name of resource to be load from EXE, DLL, OCX, CPL and other formats.
;                                 Default is -1 (no resource to be loaded, only file of local image).
;                  Left         - [optional] The left side of the control (default is 0).
;                  Top          - [optional] The top of the control (default if 0).
;                  Width        - [optional] The width of the control. Default is -1 (original picture width).
;                  Height       - [optional] The height of the control. Default is -1 (original picture height).
;                  ResType      - [optional] The type of resource to be load. Default is -1 ($RT_RCDATA).
;                  SetBkColor   - [optional] The bgcolor in hex RGB (does not obey opt(colormode)). Default is -1 (transparent).
;                  Border       - [optional] Specifies that a control has a border with a sunken edge. Default is -1 (no border).
; Return values .: Success      - Returns the identifier (controlID) of the new control.
;                  Failure      - Returns 0 if picture cannot be created.
; Author ........: João Carlos (jscript)
; Modified.......:
; Remarks .......: This function attempts to embed an 'ActiveX Control' or a 'Document Object' inside the GUI.
;                  'Document Objects' will only be visible if the Windows style $WS_CLIPCHILDREN has been used in GUICreate().
;                  The GUI functions GUICtrlRead and GUICtrlSet have no effect on this control. The object can only be
;                  controlled using 'methods' or 'properties' on the $ObjectVar, see:
;                  1 - To set or change information in the control see _GUICtrlPic_Set...
;                  2 - To update the picture after the dialog box is displayed just use _GUICtrlPic_SetImage.
;                  3 - If you want to have a picture having the same size as the file content just use width=height=0 OR -1.
;                  4 - Default resizing is $GUI_DOCKSIZE.
;                  5 - If a picture is set as a background picture, as the other controls will overlap, it's important to disable
;                      the pic control and create it after the others controls: _GUICtrlPic_SetState( controlID, $GUI_DISABLE ).
;                  6 - The extended style $GUI_WS_EX_PARENTDRAG can be used to allow the dragging of the parent window for windows
;                      that don't have a titlebar. Just use: GUICtrlSetStyle( controlID[0], -1, $GUI_WS_EX_PARENTDRAG ).
;                  7 - If the "SetBkColor" is no set, the background is always set to transparent. GUICtrlSetBkColor() has not
;                      effect on pic control.
; Related .......: The resource type: $RT_ICON is not supported.
; Link ..........;
; Example .......; _GUICtrlPic_Create( "shell32.dll", 131, 0, 0, -1, -1, $RT_BITMAP )
; ===============================================================================================================================
Func _GUICtrlPic_Create($sFileName, $vResName = -1, $iLeft = 0, $iTop = 0, $iWidth = -1, $iHeight = -1, $vResType = -1, _
        $sSetBkColor = -1, $iBorder = -1)
    Local $oShell, $iActiveXID, $iControlID
    Local $sInnerHTML = '<img id="image1" SRC="'
    Local $sIsHttpFile = StringInStr($sFileName, "/", -1, 1)

    If Not FileExists($sFileName) Then Return SetError(0, 0, 0)

    If $iWidth = 0 Then $iWidth = -1
    If $iHeight = 0 Then $iHeight = -1
    If $vResType = -1 Then $vResType = 10 ;$RT_RCDATA

    If $sIsHttpFile Then
        $sInnerHTML &= $sFileName
    ElseIf $vResName = -1 Then
        $sInnerHTML &= 'file:///' & $sFileName
    Else
        $sInnerHTML &= 'res://' & $sFileName & '/' & $vResType & '/' & $vResName
    EndIf
    $sInnerHTML &= '">'

    Switch $sSetBkColor ; 16 colors by name, HTML 4.01 standard
        Case 'black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua'
        Case $sSetBkColor > -1 And IsNumber($sSetBkColor)
            $sSetBkColor = Hex($sSetBkColor, 6)
        Case Else
            $sSetBkColor = __GUICtrlPic_GetSysColor()
    EndSwitch

    If $iBorder = -1 Then
        $iBorder = 0
    Else
        $iBorder = Abs($iBorder)
    EndIf

    $oShell = ObjCreate("Shell.Explorer.2")
    If @error Then Return SetError(0, 0, 0)

    $iActiveXID = GUICtrlCreateObj($oShell, $iLeft, $iTop, 0, 0)
    If $iActiveXID = 0 Then Return SetError(0, 0, 0)

    $oShell.navigate("about:blank")
    While $oShell.Busy()
        Sleep(10)
    WEnd
    With $oShell.document
        .write('<HEAD><TITLE></TITLE><script language="javascript"></script></HEAD>')
        .write('<body onselectstart="return false" oncontextmenu="return false" onclick="return false" ondragstart="return false" ondragover="return false">')
        .body.innerHTML = $sInnerHTML
        .body.topmargin = 0
        .body.leftmargin = 0
        .body.scroll = "no"
        .body.bgcolor = $sSetBkColor
        .body.style.backgroundColor = $sSetBkColor
        .body.style.borderWidth = $iBorder
    EndWith
    $oShell.document.getElementById("image1" ).style.backgroundColor = "transparent"
    If $iWidth <> -1 Then $oShell.document.getElementById("image1" ).width = $iWidth
    If $iHeight <> -1 Then $oShell.document.getElementById("image1" ).height = $iHeight
    $iWidth = $oShell.document.getElementById("image1" ).width
    $iHeight = $oShell.document.getElementById("image1" ).height
    GUICtrlSetPos(-1, $iLeft, $iTop, $iWidth, $iHeight)

    $iControlID = GUICtrlCreateLabel("", $iLeft, $iTop, $iWidth, $iHeight, -1, 0x00000020) ; Dummy control for used by other functions like GUICtrlSetTip...
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetState(-1, 8192 + 2048)

    ; Default resizing is $GUI_DOCSIZE = 768
    ; The automatic resizing event can be disabled if GUIEventOptions(Option) is set to 1.
    Local $sResizeMode = Opt("GUIResizeMode")
    If Opt("GUIEventOptions") = 0 And $sResizeMode = 0 Then
        GUICtrlSetResizing(-1, 768)
        GUICtrlSetResizing($iActiveXID, 768)
    ElseIf $sResizeMode > 0 Then
        GUICtrlSetResizing(-1, $sResizeMode)
        GUICtrlSetResizing($iActiveXID, $sResizeMode)
    EndIf

    For $i = 1 To $aGRP_OBJECTID[0][0]
        If $aGRP_OBJECTID[$i][0] = $iControlID Then
            $aGRP_OBJECTID[$i][1] = $oShell
            $aGRP_OBJECTID[$i][2] = $iActiveXID
            $aGRP_OBJECTID[$i][3] = $iLeft
            $aGRP_OBJECTID[$i][4] = $iTop
            Return $iControlID
        EndIf
    Next

    ReDim $aGRP_OBJECTID[UBound($aGRP_OBJECTID, 1) + 1][5]
    $aGRP_OBJECTID[0][0] += 1
    $aGRP_OBJECTID[$aGRP_OBJECTID[0][0]][0] = $iControlID
    $aGRP_OBJECTID[$aGRP_OBJECTID[0][0]][1] = $oShell
    $aGRP_OBJECTID[$aGRP_OBJECTID[0][0]][2] = $iActiveXID
    $aGRP_OBJECTID[$aGRP_OBJECTID[0][0]][3] = $iLeft
    $aGRP_OBJECTID[$aGRP_OBJECTID[0][0]][4] = $iTop
    Return $iControlID
EndFunc   ;==>_GUICtrlPic_Create

Func __GetImageDim($file) ;code by Melba23 - modified by UEZ
    Local $sFile = StringRegExp($file, "(?i).*\\(.*)", 3)
    If Not IsArray($sFile) Or @error Then Return SetError(1, 0, 0)
    Local $sPath = StringRegExp($file, "(?i)(.*)\\.+", 3)
    If Not IsArray($sFile) Or @error Then Return SetError(1, 0, 0)
    Local $sDimensions = ""
    Local $oShellApp = ObjCreate("shell.application")
    If IsObj($oShellApp) Then
        Local $oDir = $oShellApp.NameSpace($sPath[0])
        If IsObj($oDir) Then
            Local $oFile = $oDir.Parsename($sFile[0])
            If IsObj($oFile) Then
                If @OSBuild > 6000 Then
                    $sDimensions = $oDir.GetDetailsOf($oFile, 31)
                ElseIf @OSVersion = "WIN_XP" Then
                    $sDimensions = $oDir.GetDetailsOf($oFile, 26)
                EndIf
            EndIf
        EndIf
    EndIf
    If $sDimensions = "" Then Return SetError(1, 0, 0) ;"Object creation failed"
    Local $aDimensions = StringRegExp($sDimensions, "(?i)[\d]*x*[\d]", 3)
    If Not IsArray($aDimensions) Then Return SetError(1, 0, 0) ;"Cannot get image resolution!"
    Return SetError(0, 0, $aDimensions)
EndFunc   ;==>GetImageDim

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlPic_Delete
; Description ...: Deletes a control returned by _GUICtrlPic_Create.
; Syntax.........: _GUICtrlPic_Delete( controlID )
; Parameters ....: controlID - The control identifier (controlID) as returned by a _GUICtrlPic_Create function.
; Return values .: Success   - Returns 1.
;                  Failure   - Returns 0.
; Author ........: João Carlos (jscript)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; _GUICtrlPic_Delete($iCtrlID)
; ===============================================================================================================================
Func _GUICtrlPic_Delete($iCtrlID)
    Local $aClone[1][5]

    If $iCtrlID = -1 Then $iCtrlID = __GUIGetLastCtrlID()
    For $i = 1 To $aGRP_OBJECTID[0][0]
        If $aGRP_OBJECTID[$i][0] = $iCtrlID Then ContinueLoop
        ReDim $aClone[UBound($aClone, 1) + 1][5]
        $aClone[0][0] += 1
        For $j = 0 To 4
            $aClone[$aClone[0][0]][$j] = $aGRP_OBJECTID[$i][$j]
        Next
    Next
    $aGRP_OBJECTID = $aClone
    $aClone = 0
    GUICtrlSetState(($iCtrlID - 1), 32 + 128)
    Return GUICtrlDelete($iCtrlID)
EndFunc   ;==>_GUICtrlPic_Delete

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlPic_SetResizing
; Description ...: Defines the resizing method used by a _GUICtrlPic_Create.
; Syntax.........: _GUICtrlPic_SetResizing( FileName, [ ResName [, Left [, Top [, Width [, Height [, ResType [, SetBkColor [, Border ]]]]]]]] )
; Parameters ....: controlID    - The control identifier (controlID) as returned by a _GUICtrlPic_Create function.
;                  resizing     - The type of resize values to be used, add together multiple values if required.
;                                 See the Docking Values table in the GUICtrlSetResizing Function Reference
; Return values .: Success      - Returns 1
;                  Failure      - Returns 0.
; Author ........: João Carlos (jscript)
; Modified.......:
; Remarks .......: The default resizing for a given control is control dependent see the control doc.
;                  A default value for any control can be set with GUIResizeMode(Option).
;                  The automatic resizing event can be disabled if GUIEventOptions(Option) is set to 1.
; Related .......:
; Link ..........;
; Example .......; _GUICtrlPic_SetResizing($iCtrlID, $GUI_DOCKALL)
; ===============================================================================================================================
Func _GUICtrlPic_SetResizing($iCtrlID, $iResizing)
    If $iCtrlID = -1 Then $iCtrlID = __GUIGetLastCtrlID()
    For $i = 1 To $aGRP_OBJECTID[0][0]
        If $aGRP_OBJECTID[$i][0] <> $iCtrlID Then ContinueLoop
        GUICtrlSetResizing($aGRP_OBJECTID[$i][2], $iResizing)
        Return GUICtrlSetResizing($aGRP_OBJECTID[$i][0], $iResizing)
    Next
    Return 0
EndFunc   ;==>_GUICtrlPic_SetResizing

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlPic_SetState
; Description ...: Defines the resizing method returned by a _GUICtrlPic_Create.
; Syntax.........: _GUICtrlPic_SetState( controlID, state )
; Parameters ....: controlID    - The control identifier (controlID) as returned by a _GUICtrlPic_Create function.
;                  state        - See the State values below.
; Return values .: Success      - Returns 1
;                  Failure      - Returns 0.
; Author ........: João Carlos (jscript)
; Modified.......:
; Remarks .......: Suported state values:
;                  _________________________________________________________________________
;                  $GUI_SHOW    -> Control will be visible.
;                  $GUI_HIDE    -> Control will not be visible.
;                  $GUI_ENABLE  -> Control will be enabled.
;                  $GUI_DISABLE -> Control will be greyed out.
;                  $GUI_ONTOP   -> Control will be have the ontop attribute for the window .
;                  Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯
;                  State values can be summed up as: $GUI_DISABLE + $GUI_HIDE sets the control in an disabled and hidden state.
; Related .......:
; Link ..........;
; Example .......; _GUICtrlPic_SetState($iCtrlID, $GUI_HIDE)
; ===============================================================================================================================
Func _GUICtrlPic_SetState($iCtrlID, $iState)
    If $iCtrlID = -1 Then $iCtrlID = __GUIGetLastCtrlID()
    For $i = 1 To $aGRP_OBJECTID[0][0]
        If $aGRP_OBJECTID[$i][0] <> $iCtrlID Then ContinueLoop
        If BitAND($iState, 16) Then $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).style.visibility = "visible"
        If BitAND($iState, 32) Then $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).style.visibility = "hidden"
        GUICtrlSetState($aGRP_OBJECTID[$i][2], $iState)
        Return GUICtrlSetState($aGRP_OBJECTID[$i][0], $iState)
    Next
    Return 0
EndFunc   ;==>_GUICtrlPic_SetState

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlPic_SetPos
; Description ...: Changes the position of a control _GUICtrlPic_Create in the GUI window.
; Syntax.........: _GUICtrlPic_SetPos( controlID, left, top [, width [, height]] )
; Parameters ....: controlID    - The control identifier (controlID) as returned by a _GUICtrlPic_Create function.
;                  left         - The left side of the control.
;                  top          - The top of the control.
;                  width        - [optional] The width of the control. Default is keyword "Default".
;                  height       - [optional] The height of the control. Default is keyword "Default".
; Return values .: Success      - Returns 1
;                  Failure      - Returns 0.
; Author ........: João Carlos (jscript)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; _GUICtrlPic_SetPos($iCtrlID, $iLeft, $iTop)
; ===============================================================================================================================
Func _GUICtrlPic_SetPos($iCtrlID, $iLeft, $iTop, $iWidth = Default, $iHeight = Default)
    If $iCtrlID = -1 Then $iCtrlID = __GUIGetLastCtrlID()
    For $i = 1 To $aGRP_OBJECTID[0][0]
        If $aGRP_OBJECTID[$i][0] <> $iCtrlID Then ContinueLoop
        $aGRP_OBJECTID[$i][3] = $iLeft
        $aGRP_OBJECTID[$i][4] = $iTop
        If $iWidth <> Default And $iWidth <> -1 Then $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).width = $iWidth
        If $iHeight <> Default And $iHeight <> -1 Then $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).height = $iHeight
        $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).style.visibility = "hidden"
        GUICtrlSetPos($aGRP_OBJECTID[$i][2], $iLeft, $iTop, $iWidth, $iHeight)
        GUICtrlSetPos($aGRP_OBJECTID[$i][0], $iLeft, $iTop, $iWidth, $iHeight)
        $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).style.visibility = "visible"
        Return 1;_GUICtrlPic_SetState($iCtrlID, 16)
    Next
    Return 0
EndFunc   ;==>_GUICtrlPic_SetPos

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlPic_GetPos
; Description ...: Retrieves the position and size of a control returned by _GUICtrlPic_Create relative to it's window.
; Syntax.........: _GUICtrlPic_SetPos( controlID )
; Parameters ....: controlID - The control identifier (controlID) as returned by a _GUICtrlPic_Create function.
; Return values .: Success   - Returns an array containing the size and the control's position relative to it's client window:
;                              $array[0] = X position
;                              $array[1] = Y position
;                              $array[2] = Width
;                              $array[3] = Height
;                  Failure   - Sets @error to 1.
; Author ........: João Carlos (jscript)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; _GUICtrlPic_GetPos($iCtrlID)
; ===============================================================================================================================
Func _GUICtrlPic_GetPos($iCtrlID)
    Local $aReturn[4]

    If $iCtrlID = -1 Then $iCtrlID = __GUIGetLastCtrlID()
    For $i = 1 To $aGRP_OBJECTID[0][0]
        If $aGRP_OBJECTID[$i][0] <> $iCtrlID Then ContinueLoop
        $aReturn[0] = $aGRP_OBJECTID[$i][3]
        $aReturn[1] = $aGRP_OBJECTID[$i][4]
        $aReturn[2] = $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).width
        $aReturn[3] = $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).height
        Return $aReturn
    Next
    Return SetError(1, 0, 0)
EndFunc   ;==>_GUICtrlPic_GetPos

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlPic_SetImage
; Description ...: Sets the picture or resource to be loaded, supported types: BMP, JPG, PNG, GIF(animated).
; Syntax.........: _GUICtrlPic_SetImage( controlID, FileName [, ResName [, ResType [, FixSize ]]] )
; Parameters ....: controlID    - The control identifier (controlID) as returned by a _GUICtrlPic_Create function.
;                  FileName     - Filename of the picture or resource to be loaded, supported types: BMP, JPG, PNG, GIF(animated).
;                                 Can be an URL path too.
;                  ResName      - [optional] The name of resource to be load from EXE, DLL, OCX, CPL and other formats.
;                                 Default is -1 (no resource to be loaded, only file of local image).
;                  ResType      - [optional] The type of resource to be load. Default is -1 ($RT_RCDATA).

; Return values .: Success      - Returns 1
;                  Failure      - Returns 0.
; Author ........: João Carlos (jscript)
; Modified.......:
; Remarks .......: The resource type: $RT_ICON is not supported.
; Related .......:
; Link ..........;
; Example .......; _GUICtrlPic_SetImage($iCtrlID, $iLeft, $iTop)
; ===============================================================================================================================
Func _GUICtrlPic_SetImage($iCtrlID, $sFileName, $vResName = -1, $vResType = -1, $lFixSize = True)
    Local $sInnerHTML = '<img id="image1" SRC="'
    Local $sIsHttpFile = StringInStr($sFileName, "/", 0, 1)
    Local $iWidth, $iHeight, $iIsVideo

    If $iCtrlID = -1 Then $iCtrlID = __GUIGetLastCtrlID()
    If $sIsHttpFile = 0 And FileExists($sFileName) = 0 Then Return SetError(0, 0, 0)
    If $vResType = -1 Then $vResType = 10 ;$RT_RCDATA

    For $i = 1 To $aGRP_OBJECTID[0][0]
        If $aGRP_OBJECTID[$i][0] <> $iCtrlID Then ContinueLoop
        $iIsVideo = StringInStr($aGRP_OBJECTID[$i][1] .document.body.outerHTML, "<embed", 0, 1)
        If StringInStr($sFileName, "<embed", 0, 1) Then
            $sInnerHTML = $sFileName
        Else
            If Not $iIsVideo Then
                $iWidth = $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).width
                $iHeight = $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).height
            EndIf
            If $sIsHttpFile Then
                $sInnerHTML &= $sFileName
            ElseIf $vResName = -1 Then
                $sInnerHTML &= 'file:///' & $sFileName
            Else
                $sInnerHTML &= 'res://' & $sFileName & '/' & $vResType & '/' & $vResName
            EndIf
            $sInnerHTML &= '">'
        EndIf
        $aGRP_OBJECTID[$i][1] .document.body.innerHTML = $sInnerHTML
        If $lFixSize And Not $iIsVideo Then
            $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).width = $iWidth
            $aGRP_OBJECTID[$i][1] .document.getElementById("image1" ).height = $iHeight
        EndIf
        Return 1
    Next
    Return 0
EndFunc   ;==>_GUICtrlPic_SetImage

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: _GUICtrlPic_GetSysColor
; Description ...: Returns the system color.
; Syntax.........: _GUICtrlPic_GetSysColor( [ ColorRegion ] )
; Parameters ....: ColorRegion  - [optional] The region of the system color. Default is COLOR_BTNFACE.
; Return values .: Hex color
; Author ........: jscript
; Modified.......:
; Remarks .......: If EzSkin.au3 modified by jscript from original by Valuater is used, return $vDAT_COLOR_BACKGND.
; Related .......:
; Link ..........;
; Example .......; _GUICtrlPic_GetSysColor()
; ===============================================================================================================================
Func __GUICtrlPic_GetSysColor($iColorRegion = 15); 15 = COLOR_BTNFACE
    Local $sGetSysColor
    ; If EzSkin.au3 modified by jscript from original by Valuater is used...
    If IsDeclared("vDAT_COLOR_BACKGND") Then Return Hex(Eval("vDAT_COLOR_BACKGND"), 6)

    $sGetSysColor = DllCall('user32.dll', 'int', 'GetSysColor', 'int', $iColorRegion)
    $sGetSysColor = Hex($sGetSysColor[0], 6); BGR format
    ; Converts BGR to RGB color mode
    Return StringTrimLeft($sGetSysColor, 4) & StringTrimLeft(StringTrimRight($sGetSysColor, 2), 2) & StringTrimRight($sGetSysColor, 4)
EndFunc   ;==>_GUICtrlPic_GetSysColor

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: _GUIGetLastCtrlID
; Description ...: Returns the last ctrlID referenced
; Syntax ........: _GUIGetLastCtrlID(  )
; Parameters ....:
; Return values .: None
; Author(s) .....: MrCreaTor
; Modified ......: João Carlos (Jscript FROM Brazil)
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __GUIGetLastCtrlID()
    Local $aRet = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1))
    Return $aRet[0]
EndFunc   ;==>_GUIGetLastCtrlID

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Something like this?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinApi.au3>

$hGUI = GUICreate("Yet Another Gif Example", 280, 440, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME),$WS_EX_LAYERED)
;create the object
$oObj = ObjCreate("Shell.Explorer.2")
$oObj_ctrl = GUICtrlCreateObj($oObj, 20, 20, 240, 380)
;resize control when the window resizes
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
;replace this with your own (from local hdd, web, ...):
$sGIF = @ScriptDir&"\Dance.gif"
;show the image
$URL = "about:<html><body bgcolor='#dedede' scroll='no'><img src='"&$sGIF&"' width='90%' height='100%' border='0'></img></body></html>"
$oObj.Navigate($URL)
;restrict right click
GUICtrlSetState(-1,$GUI_DISABLE)
_WinAPI_SetLayeredWindowAttributes($hGUI,0xdedede)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            $oObj=0 ;destroy object...
            Exit
    EndSwitch
WEnd
Link to comment
Share on other sites

Have a look at this >> It might help?! I modified the Example to a Function >>

Global $Test = GUICreate("_GIFImage()", 250, 400)
GUISetBkColor(0xFFFFFF, $Test)
_GIFImage(@ScriptDir & "\Example_3.gif", 16, 16)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd

Func _GIFImage($gi_Image, $gi_Width, $gi_Height, $gi_Left = 5, $gi_Top = 5)
    Local $gi_WMIService = ObjCreate("Shell.Explorer.2")
    Local $gi_WMIService_Ctrl = GUICtrlCreateObj($gi_WMIService, $gi_Left, $gi_Top, $gi_Width, $gi_Height)
    $gi_WMIService.Navigate("about:blank")
    While $gi_WMIService.Busy()
        Sleep(10)
    WEnd
    Local $gi_GetSystemColour, $gi_ColourRegion = 15
    If IsDeclared("vDAT_COLOR_BACKGND") Then Return Hex(Eval("vDAT_COLOR_BACKGND"), 6) ; <<<<< I believe this should be changed to 4 or 5?!
    $gi_GetSystemColour = DllCall('user32.dll', 'int', 'GetSysColor', 'int', $gi_ColourRegion)
    $gi_GetSystemColour = Hex($gi_GetSystemColour[0], 6)
    Local $gi_SystemColour = StringTrimLeft($gi_GetSystemColour, 4) & StringTrimLeft(StringTrimRight($gi_GetSystemColour, 2), 2) & StringTrimRight($gi_GetSystemColour, 4)
    With $gi_WMIService.document
        .body.innerHTML = '<img id="_GIFImage" src="' & 'file:///' & $gi_Image & '">'
        .body.topmargin = 0
        .body.leftmargin = 0
        .body.scroll = "no"
        .body.bgcolor = $gi_SystemColour
        .body.style.backgroundColor = $gi_SystemColour
        .body.style.borderWidth = 0
    EndWith
    GUICtrlSetState($gi_WMIService_Ctrl, 64)
    Return 1
EndFunc   ;==>_GIFImage
Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I'm not getting that as transparent, here is an alternative:

yes, the result is not perfect, the junction between an animated gif and background gui is not ideal...Posted Image

$gui = GUICreate("Yet Another Gif Example", 250, 250)
$guicolor = 0xff0000
GUISetBkColor($guicolor)
$oObj = ObjCreate("Shell.Explorer.2")
$oObj_ctrl = GUICtrlCreateObj($oObj, 50, 50, 129, 93 )
$sGIFp = "http://img684.imageshack.us/img684/5569/87540020.gif"
$oObj.Navigate("about:blank")
While $oObj.Busy()
    Sleep(10)
WEnd
With $oObj.document
    .write('<body onselectstart="return false" oncontextmenu="return false" onclick="return false" ondragstart="return false" ondragover="return false">')
    .body.innerHTML = '<img id="image1" SRC="' & $sGIFp & '">'
    .body.topmargin = 0
    .body.leftmargin = 0
    .body.scroll = "no"
    .body.bgcolor = $guicolor
    .body.style.borderWidth = 0
EndWith
GUICtrlSetState ( $oObj_ctrl, 64 )
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            $oObj=0 ;destroy object...
            Exit
    EndSwitch
WEnd

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

GIF Images with the ability to change the Background Colour as requested by wakillon.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Global $GUI = GUICreate("_GIFImage()", 250, 400)
GUISetBkColor(0xFFFFFF, $GUI)
_GIFImage($Test, @ScriptDir & "\Example_3.gif", 16, 16)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd

Func _GIFImage($gi_Handle, $gi_Image, $gi_Width, $gi_Height, $gi_Left = 5, $gi_Top = 5)
    Local $gi_WMIService = ObjCreate("Shell.Explorer.2")
    Local $gi_WMIService_Ctrl = GUICtrlCreateObj($gi_WMIService, $gi_Left, $gi_Top, $gi_Width, $gi_Height)
    $gi_WMIService.Navigate("about:blank")
    While $gi_WMIService.Busy()
        Sleep(10)
    WEnd

    Local $gi_Result = DllCall("user32.dll", "handle", "GetDC", "hwnd", $gi_Handle)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_DC = $gi_Result[0]
    $gi_Result = DllCall("gdi32.dll", "int", "GetBkColor", "hwnd", $gi_DC)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_GetBkColor = $gi_Result[0]
    $gi_Result = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $gi_Handle, "handle", $gi_DC)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_SystemColour = Hex(BitOR(BitAND($gi_GetBkColor, 0x00FF00), BitShift(BitAND($gi_GetBkColor, 0x0000FF), -16), BitShift(BitAND($gi_GetBkColor, 0xFF0000), 16)), 6)

    With $gi_WMIService.document
        .body.innerHTML = '<img id="_GIFImage" src="' & 'file:///' & $gi_Image & '">'
        .body.topmargin = 0
        .body.leftmargin = 0
        .body.scroll = "no"
        .body.bgcolor = $gi_SystemColour
        .body.style.backgroundColor = $gi_SystemColour
        .body.style.borderWidth = 0
    EndWith
    GUICtrlSetState($gi_WMIService_Ctrl, 64)
    Return 1
EndFunc   ;==>_GIFImage

Edit: I found the answer elsewhere but decided to check how trancexx did it >> and it seems the same way :)

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

GIF Images with the ability to change the Background Colour as requested by wakillon.

Thanks to try guinness, but that doesn't work...

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Global $GUI = GUICreate("_GIFImage()", 250, 400)
GUISetBkColor ( 0xFF0000, $GUI)
_GIFImage ( $GUI, "http://img684.imageshack.us/img684/5569/87540020.gif", 129, 93 ) ; have tried with animated gifs on local drive too...
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd

Func _GIFImage($gi_Handle, $gi_Image, $gi_Width, $gi_Height, $gi_Left = 5, $gi_Top = 5)
    Local $gi_WMIService = ObjCreate("Shell.Explorer.2")
    Local $gi_WMIService_Ctrl = GUICtrlCreateObj($gi_WMIService, $gi_Left, $gi_Top, $gi_Width, $gi_Height)
    $gi_WMIService.Navigate("about:blank")
    While $gi_WMIService.Busy()
        Sleep(10)
    WEnd
    Local $gi_Result = DllCall("user32.dll", "handle", "GetDC", "hwnd", $gi_Handle)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_DC = $gi_Result[0]
    $gi_Result = DllCall("gdi32.dll", "int", "GetBkColor", "hwnd", $gi_DC)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_GetBkColor = $gi_Result[0]
    $gi_Result = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $gi_Handle, "handle", $gi_DC)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_SystemColour = Hex(BitOR(BitAND($gi_GetBkColor, 0x00FF00), BitShift(BitAND($gi_GetBkColor, 0x0000FF), -16), BitShift(BitAND($gi_GetBkColor, 0xFF0000), 16)), 6)
    With $gi_WMIService.document
        .body.innerHTML = '[img]' & $gi_Image & [/img]'
        .body.topmargin = 0
        .body.leftmargin = 0
        .body.scroll = "no"
        .body.bgcolor = $gi_SystemColour
        .body.style.backgroundColor = $gi_SystemColour
        .body.style.borderWidth = 0
    EndWith
    GUICtrlSetState($gi_WMIService_Ctrl, 64)
    Return 1
EndFunc   ;==>_GIFImage

Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

You're right, I haven't tested with GIF images online only Local image(s). The image I tested with worked, but this one clearly doesn't! Will have a look a little more, just curious thats all :)

Edit: The background is returning as White and not Red, this is why it fails. Do you have any other examples of transparent GIFs I could test with?

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

You're right, I haven't tested with GIF images online only Local image(s). The image I tested with worked, but this one clearly doesn't! Will have a look a little more, just curious thats all :)

have tried unsucessfull with several transparent animated gifs on local drive too...Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

I tested with white this is why it worked duh! :)

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

HaHa >> try this with a Local File :)

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Global $GUI = GUICreate("_GIFImage()")
GUISetBkColor(0xFF00FF, $GUI)
GUISetState(@SW_SHOW) ; <<<<< Moved!
_GIFImage($GUI, @ScriptDir & "\Example_3.gif", 129, 93)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd

Func _GIFImage($gi_Handle, $gi_Image, $gi_Width, $gi_Height, $gi_Left = 5, $gi_Top = 5)
    Local $gi_WMIService = ObjCreate("Shell.Explorer.2")
    Local $gi_WMIService_Ctrl = GUICtrlCreateObj($gi_WMIService, $gi_Left, $gi_Top, $gi_Width, $gi_Height)
    $gi_WMIService.Navigate("about:blank")
    While $gi_WMIService.Busy()
        Sleep(10)
    WEnd

    Local $gi_Result = DllCall("user32.dll", "handle", "GetDC", "hwnd", $gi_Handle)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_DC = $gi_Result[0]
    $gi_Result = DllCall("gdi32.dll", "int", "GetBkColor", "hwnd", $gi_DC)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_GetBkColor = $gi_Result[0]
    $gi_Result = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $gi_Handle, "handle", $gi_DC)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_SystemColour = Hex(BitOR(BitAND($gi_GetBkColor, 0x00FF00), BitShift(BitAND($gi_GetBkColor, 0x0000FF), -16), BitShift(BitAND($gi_GetBkColor, 0xFF0000), 16)), 6)
    With $gi_WMIService.document
        .body.innerHTML = '<img id="_GIFImage" src="' & 'file:///' & $gi_Image & '">'
        .body.topmargin = 0
        .body.leftmargin = 0
        .body.scroll = "no"
        .body.bgcolor = $gi_SystemColour
        .body.style.backgroundColor = $gi_SystemColour
        .body.style.borderWidth = 0
    EndWith
    GUICtrlSetState($gi_WMIService_Ctrl, 64)
    Return 1
EndFunc   ;==>_GIFImage
Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

And for Online >>

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Global $GUI = GUICreate("_GIFImage()")
GUISetBkColor(0xFF00FF, $GUI)
GUISetState(@SW_SHOW) ; <<<<< Moved!
;~ _GIFImage($GUI, @ScriptDir & "\Example_3.gif", 129, 93) ; Local.
_GIFImage($GUI, "http://img684.imageshack.us/img684/5569/87540020.gif", 129, 93) ; Online.


While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd

Func _GIFImage($gi_Handle, $gi_Image, $gi_Width, $gi_Height, $gi_Left = 5, $gi_Top = 5)
    Local $gi_WMIService = ObjCreate("Shell.Explorer.2")
    Local $gi_WMIService_Ctrl = GUICtrlCreateObj($gi_WMIService, $gi_Left, $gi_Top, $gi_Width, $gi_Height)
    $gi_WMIService.Navigate("about:blank")
    While $gi_WMIService.Busy()
        Sleep(10)
    WEnd

    Local $gi_Result = DllCall("user32.dll", "handle", "GetDC", "hwnd", $gi_Handle)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_DC = $gi_Result[0]
    $gi_Result = DllCall("gdi32.dll", "int", "GetBkColor", "hwnd", $gi_DC)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_GetBkColor = $gi_Result[0]
    $gi_Result = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $gi_Handle, "handle", $gi_DC)
    If @error Then Return SetError(@error, @extended, 0)
    Local $gi_SystemColour = Hex(BitOR(BitAND($gi_GetBkColor, 0x00FF00), BitShift(BitAND($gi_GetBkColor, 0x0000FF), -16), BitShift(BitAND($gi_GetBkColor, 0xFF0000), 16)), 6)
    With $gi_WMIService.document
        .body.innerHTML = '<img id="_GIFImage" src="' & $gi_Image & '">'
        .body.topmargin = 0
        .body.leftmargin = 0
        .body.scroll = "no"
        .body.bgcolor = $gi_SystemColour
        .body.style.backgroundColor = $gi_SystemColour
        .body.style.borderWidth = 0
    EndWith
    GUICtrlSetState($gi_WMIService_Ctrl, 64)
    Return 1
EndFunc   ;==>_GIFImage

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

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