Jump to content



Photo

Yet another GIF display


  • Please log in to reply
47 replies to this topic

#1 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 18 February 2011 - 12:19 PM

It's not compared with Trancexx's, but it works for me. The example resizes with the gui:
AutoIt         
#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






#2 playlet

playlet

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 459 posts

Posted 18 February 2011 - 01:50 PM

I had to move GUICtrlSetState(-1, $GUI_DISABLE) just after $oObj.Navigate($URL) to make it work.
Very simple and easy to use.
Thanks for this!

#3 JScript

JScript

    Goodbye everybody, I got tired of this system adopted here!

  • Active Members
  • PipPipPipPipPipPip
  • 1,062 posts

Posted 18 February 2011 - 01:58 PM

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!
AutoIt         
#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://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#4 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,474 posts

Posted 18 February 2011 - 10:12 PM

Nice ! Posted Image

Is there a way your script support Gif transparency ?

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#5 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 18 February 2011 - 10:33 PM

Something like this?

AutoIt         
#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


#6 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,474 posts

Posted 19 February 2011 - 08:09 AM

Something like this?



Not Exactly !
I wanted see the background of the gui, not of the desktop...Posted Image

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#7 playlet

playlet

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 459 posts

Posted 19 February 2011 - 11:29 AM

Perhaps this:
AutoIt         
GUICreate("Yet Another Gif Example", 250, 400) $oObj = ObjCreate("Shell.Explorer.2") $oObj_ctrl = GUICtrlCreateObj($oObj, 5, 5, 220, 19) $sGIFp = @ScriptDir & "\3.gif" $oObj.Navigate("about:blank") While $oObj.Busy()     Sleep(10) WEnd With $oObj.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 = '<img id="image1" SRC="' & 'file:///' & $sGIFp & '">'; ili ovako: .body.innerHTML = '<img id="image1" SRC="' & $sGIF & '">'     .body.topmargin = 0     .body.leftmargin = 0     .body.scroll = "no"     .body.bgcolor = __GUICtrlPic_GetSysColor()     .body.style.backgroundColor = __GUICtrlPic_GetSysColor()     .body.style.borderWidth = 0 EndWith ;$oObj.document.getElementById("image1").style.backgroundColor = "transparent" GUICtrlSetState($oObj_ctrl, 64) GUISetState(@SW_SHOW) While 1     Sleep(10)     Switch GUIGetMsg()         Case -3             $oObj=0 ;destroy object...             Exit     EndSwitch WEnd ;########## Functions from jscript's UDF (_GUIResourcePic.au3 - "<a href='http://www.autoitscript.com/forum/topic/100167-guiresourcepicau3-udf/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/100167-guiresourcepicau3-udf/"</a>) ################## Func __GUICtrlPic_GetSysColor($iColorRegion = 15); <a href='http://www.autoitscript.com/forum/topic/100167-guiresourcepicau3-udf' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/100167-guiresourcepicau3-udf</a>     Local $sGetSysColor     If IsDeclared("vDAT_COLOR_BACKGND") Then Return Hex(Eval("vDAT_COLOR_BACKGND"), 6)     $sGetSysColor = DllCall('user32.dll', 'int', 'GetSysColor', 'int', $iColorRegion); 15 = COLOR_BTNFACE     $sGetSysColor = Hex($sGetSysColor[0], 6); BGR format     Return StringTrimLeft($sGetSysColor, 4) & StringTrimLeft(StringTrimRight($sGetSysColor, 2), 2) & StringTrimRight($sGetSysColor, 4) EndFunc   ;==>_GUICtrlPic_GetSysColor ;##########################################################################################################################################################


Don't forget to change object size according to your gif ($oObj_ctrl = GUICtrlCreateObj($oObj, 5, 5, 220, 19)).

Edited by playlet, 19 February 2011 - 11:31 AM.


#8 taietel

taietel

    I'm the third from the left...

  • Active Members
  • PipPipPipPipPipPip
  • 722 posts

Posted 19 February 2011 - 12:04 PM

Thanks for the feedback guys!

jscript, thanks for sharing!

playlet, I think that's wakillon is after. :)

#9 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,474 posts

Posted 19 February 2011 - 01:44 PM

Perhaps this:

Don't forget to change object size according to your gif ($oObj_ctrl = GUICtrlCreateObj($oObj, 5, 5, 220, 19)).


Thanks for your help, but it works only if gui background is blank...

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#10 guinness

guinness

    guinness

  • MVPs
  • 10,230 posts

Posted 19 February 2011 - 01:50 PM

Have a look at this >> http://www.autoitscript.com/forum/topic/92587-guictrlgetcolor/page__view__findpost__p__665439 It might help?! I modified the Example to a Function >>
AutoIt         
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, 19 February 2011 - 02:47 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#11 playlet

playlet

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 459 posts

Posted 19 February 2011 - 02:29 PM

I'm not getting that as transparent, here is an alternative:
AutoIt         
$gui = GUICreate("Yet Another Gif Example", 250, 200) $guicolor = 0xff0000 GUISetBkColor($guicolor) $oObj = ObjCreate("Shell.Explorer.2") $oObj_ctrl = GUICtrlCreateObj($oObj, 5, 5, 220, 19) $sGIFp = @ScriptDir & "\3.gif" $oObj.Navigate("about:blank") While $oObj.Busy()     Sleep(10) WEnd With $oObj.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 = '<img id="image1" SRC="' & 'file:///' & $sGIFp & '">'; ili ovako: .body.innerHTML = '<img id="image1" SRC="' & $sGIF & '">'     .body.topmargin = 0     .body.leftmargin = 0     .body.scroll = "no"     .body.bgcolor = $guicolor     .body.style.backgroundColor = $guicolor     .body.style.borderWidth = 0 EndWith ;$oObj.document.getElementById("image1").style.backgroundColor = "transparent" GUICtrlSetState($oObj_ctrl, 64) GUISetState(@SW_SHOW) While 1     Sleep(10)     Switch GUIGetMsg()         Case -3             $oObj=0 ;destroy object...             Exit     EndSwitch WEnd


Here's one example with png images:
AutoIt         
#include <Winapi.au3> #include <gdiplus.au3> _GDIPlus_Startup() $AGUI_BG = GUICreate("ULAIG", 228, 310, -1, -1, 0x80000000, BitOR(0x00080000, 0x00000008), 0x80) $AGUI_Text = GUICreate("ULACG", 228, 310, -1, -1, 0x80000000, BitOR(0x00080000, 0x00000040), $AGUI_BG) GUISetBkColor(0x003842, $AGUI_Text) _WinAPI_SetLayeredWindowAttributes($AGUI_Text, 0x003842, 255) $AClose = GUICtrlCreateButton("Close", 83, 259, 60, 20, 0x0001) GUICtrlSetBkColor(-1, -2) $oObj = ObjCreate("Shell.Explorer.2") $oObj_ctrl = GUICtrlCreateObj($oObj, 5, 55, 220, 19) $oObj.Navigate("about:blank") While $oObj.Busy()     Sleep(10) WEnd With $oObj.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 = '<img id="image1" SRC="' & 'file:///' & @ScriptDir & "\3.gif" & '">'     .body.topmargin = 0     .body.leftmargin = 0     .body.scroll = "no"     .body.bgcolor = 0x003842     .body.style.backgroundColor = 0x003842     .body.style.borderWidth = 0 EndWith GUICtrlSetState($oObj_ctrl, 64) GUISetState(@SW_SHOW, $AGUI_BG) $dd = _GDIPlus_ImageLoadFromFile("test.png") SetBitmap($AGUI_BG, $dd, 255) GUISetState(@SW_SHOW, $AGUI_Text) While 1     $aa = GUIGetMsg()     If $aa = -3 Or $aa = $AClose Then Exit WEnd Func SetBitmap($hGUI, $hImage, $iOpacity)     Local $hScrDC = _WinAPI_GetDC(0)     Local $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)     Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)     Local $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)     $tSize = DllStructCreate("long X;long Y")     $pSize = DllStructGetPtr($tSize)     DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))     DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))     $tSource = DllStructCreate("long X;long Y")     $pSource = DllStructGetPtr($tSource)     $tBlend = DllStructCreate("byte Op;byte Flags;byte Alpha;byte Format")     $pBlend = DllStructGetPtr($tBlend)     DllStructSetData($tBlend, "Alpha", $iOpacity)     DllStructSetData($tBlend, "Format", 1)     _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 0x02)     _WinAPI_ReleaseDC(0, $hScrDC)     _WinAPI_SelectObject($hMemDC, $hOld)     _WinAPI_DeleteObject($hBitmap)     _WinAPI_DeleteDC($hMemDC) EndFunc   ;==>SetBitmap

Edited by playlet, 19 February 2011 - 02:44 PM.


#12 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,474 posts

Posted 19 February 2011 - 03:10 PM

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

AutoIt         
$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 = "<a href='http://img684.imageshack.us/img684/5569/87540020.gif' class='bbc_url' title='External link' rel='nofollow external'>http://img684.imageshack.us/img684/5569/87540020.gif"</a> $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 Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#13 guinness

guinness

    guinness

  • MVPs
  • 10,230 posts

Posted 19 February 2011 - 10:11 PM

GIF Images with the ability to change the Background Colour as requested by wakillon.
AutoIt         
#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 >> http://www.autoitscript.com/forum/topic/96132-gif-animation/page__view__findpost__p__691115 and it seems the same way :)

Edited by guinness, 19 February 2011 - 10:14 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#14 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,474 posts

Posted 20 February 2011 - 09:10 AM

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

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


AutoIt         
#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, 20 February 2011 - 09:14 AM.

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#15 guinness

guinness

    guinness

  • MVPs
  • 10,230 posts

Posted 20 February 2011 - 09:31 AM

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, 20 February 2011 - 09:40 AM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#16 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,474 posts

Posted 20 February 2011 - 09:41 AM

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, 20 February 2011 - 09:42 AM.

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#17 guinness

guinness

    guinness

  • MVPs
  • 10,230 posts

Posted 20 February 2011 - 09:46 AM

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

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#18 guinness

guinness

    guinness

  • MVPs
  • 10,230 posts

Posted 20 February 2011 - 09:51 AM

HaHa >> try this with a Local File :)
AutoIt         
#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, 20 February 2011 - 09:51 AM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#19 guinness

guinness

    guinness

  • MVPs
  • 10,230 posts

Posted 20 February 2011 - 09:54 AM

And for Online >>
AutoIt         
#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, "<a href='http://img684.imageshack.us/img684/5569/87540020.gif' class='bbc_url' title='External link' rel='nofollow external'>http://img684.imageshack.us/img684/5569/87540020.gif"</a>, 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

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#20 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,474 posts

Posted 20 February 2011 - 10:20 AM

And for Online >>


Thanks guinness, it's better ! Posted Image

Do you know a way to attenuate the annoying blank line between gif and background ? Posted Image

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users