n'y parviens pas.
J'ai un contrôle qui est crée et J'aimerais écrire un fichier *.ini
avec la valeur du handle de ce contrôle (pour être utilisé plus tard)
mais voilà ... je n'arrive pas à récupérer ce handle.
Je pense que la solution réside peut-être dans la fonction
_guictrlcreategif() qui se trouve à la fin de mon code mais
toutes mes tentatives se sont soldées par un échec .
Une idée ?
P.s : vous aurez besoin de ORDI.gif au même endroit que le
script pour que le contrôle se crée.
- ORDI.gif (83.01 Kio) Vu 1053 fois
► Afficher le texteCode
Code : Tout sélectionner
#include <GUIConstants.au3>
#include<misc.au3>
#include<ie.au3>
Opt("GUIOnEventMode", 1)
Global $oieh
$Form1 = GUICreate("Form1", 625, 445, 193, 125)
$pic2 = _GUICtrlCreateGIF(@ScriptDir & "\" & "ordi.gif")
$www1 = ControlGetHandle($Form1, "", $oieh) ; oieh est définit dans GuictrlCreateGif
IniWrite("testtt.ini", $oieh, "Name", "test")
MsgBox(0, "", $oieh)
ObjEvent($pic2, "Pic1Click")
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func Pic1Click()
If _IsPressed("01", "user32.dll") Then
$www = ControlGetHandle($Form1, "", @COM_EventObj) ; Récupération du handle du gif
$test = IniRead("testtt.ini", $www, "Name", "Erreur")
MsgBox(0, $www, " " & $test)
If $test = "Erreur" Then
Exit
EndIf
EndIf
EndFunc ;==>Pic1Click
;===============================================================================
; UDF Name: _AnimatedGif.au3
;
; Version v1.0.0 Oct 12, 2006, built with Autoit 3.2.1.3
;
; Authors: gafrost, elgabionline, lod3n
;
; Contribution: Ed_Maximized
;
; Email: <edmundofasano [at] gmail [dot] com>
;
; Use: Creation of an animated GIF control and functions to stop/resume animation
;===============================================================================
#include-once
;===============================================================================
;
; Function Name: _GUICtrlCreateGIF()
; Description: Create an Animated GIF control
; Parameter(s): $gif [required] path and filename of the animated GIF
; $x [optional] x pos of the top-left corner
; $y [optional] y pos of the top-left corner
; $border [optional] 0 = no border
; any other = sunken border
; Requirement(s): #include <IE.au3>
; Return Value(s):
; controlID of the control created
; Author(s): elgabionline, gafrost, Ed_Maximized
;
;===============================================================================
Func _GUICtrlCreateGIF($gif, $x = 0, $y = 0, $border = 0)
Local $pwidth, $pheight, $oIE, $GUIActiveX
_GetGifPixWidth_Height($gif, $pwidth, $pheight)
$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX = GUICtrlCreateObj($oIE, $x, $y, $pwidth, $pheight)
$oIE.navigate("about:blank")
While _IEPropertyGet($oIE, "busy")
Sleep(100)
WEnd
$oIE.document.body.background = $gif
$oIE.document.body.scroll = "no"
If $border = 0 Then $oIE.document.body.style.border = "0px"
Return $oIE
$oieh = ControlGetHandle($Form1, "", $oIE)
EndFunc ;==>_GUICtrlCreateGIF
;===============================================================================
;
; Function Name: _GetGifPixWidth_Height()
; Description: return the size of a GIF image in pixels
; Parameter(s): $s_gif [required] path and filename of the animated GIF
;
; Requirement(s): #include <IE.au3>
; Return Value(s):
; $pwidth = width of the GIF in pixels
; $pheight = height of the GIF in pixels
; Author(s): gafrost
;
;===============================================================================
Func _GetGifPixWidth_Height($s_gif, ByRef $pwidth, ByRef $pheight)
If FileGetSize($s_gif) > 9 Then
Local $sizes = FileRead($s_gif, 10)
;ConsoleWrite("Gif version: " & StringMid($sizes, 1, 6) & @LF)
$pwidth = Asc(StringMid($sizes, 8, 1)) * 256 + Asc(StringMid($sizes, 7, 1))
$pheight = Asc(StringMid($sizes, 10, 1)) * 256 + Asc(StringMid($sizes, 9, 1))
;ConsoleWrite($pwidth & " x " & $pheight & @LF)
EndIf
EndFunc ;==>_GetGifPixWidth_Height