Sign in to follow this  
Followers 0
jlorenz1

Thumbnail Part II

3 posts in this topic

#1 ·  Posted (edited)

I think, principally it's a good idea to simplify your problem and then looking for a solution.

And if you got a solution so you transcribt it to your script. That worked in many cases ...

Not so in this case. I tried different things with the short solution, but i got always results,

that I don't want. In GUI I have a combobox for selecting a folder with images (No1). A second

combobox lists all image files in this folder (No2). (No3) should be a preview as thumbnail and

should always show the selected file in combobox (No2). I have made a screen of the problem

The images should be shown as max. 90 x 90 px. If a value(width or height) is smaller than 90 px

it should be centered in this field of preview. Here are the .au3 file and dll with icons

Main Problem is, that the picture, which has been loaded with GUICtrlCreateObj

will be shown x-times on the background and hide all my controls and my solution is a

bad one, because it shows all pictures as a square regardless their truth width and height. I know

reading long scripts in another language it is terrible, but I hope that someone can help me. Johannes

You will find the short solution from gafrost 23rd december here

#include <GUIConstants.au3>
#include <IE.au3>


Global $aGni = 1, $gif, $pwidth=90, $pheight=90
Global $oIE = ObjCreate("Shell.Explorer.2")
Global $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 90, 90)
Global $Titel ='Wikipediafüller'
Global $sMyPic =''
Global $sMyFol1 =''
Global $sMyFol2 =''
Global $KsbAlles = ''
Global $LzeAlles = ''
Global $VonAlles = ''
Global $DrcAlles = ''

Global $aPic [101]
Global $cPic = ''
Global $aGn  = StringSplit('Die Urheberrechts-Schutzdauer des hier abgebildeten flächigen Kunstwerks ist weltweit abgelaufen, da der Künstler bereits seit über 70 Jahren tot ist. Es ist somit gemeinfrei (»public domain«) |Ich bin Inhaber bzw. Fotograf des hier abgebildeten flächigen Werkes und erlaube es unter der freien Lizenz (»public domain«) zu veröffentlichen. ' & @MDAY & '.' & @Mon & '.' & @Year, '|')



$GUI = GUICreate($Titel, 320, 590, @Desktopwidth - 325, @DesktopHeight - 625, -1,$WS_EX_TOPMOST)
GUISetIcon (@ScriptDir & '\wiki.dll',13)
$filemenu = GUICtrlCreateMenu ("&Datei")
$fileitem = GUICtrlCreateMenuitem ("Ö&ffnen",$filemenu)

$tab=GUICtrlCreateTab (10, 5, 300, 515)
$tab0=GUICtrlCreateTabitem ('Eingabe')
GUICtrlCreateLabel('Ordner mit den hochzuladenden Bildern',20,35,200,15)
$c01 = GUICtrlCreateCombo('', 20, 50,255, 60)
$b01 = GUICtrlCreateButton('', 280, 48, 24, 24, $BS_ICON)
        GUICtrlSetImage ($b01, @ScriptDir & '\wiki.dll', 8)
        GUICtrlSetTip($b01, 'Ordner mit den hochzuladenden Bildern auswählen')
;*************************** This is the thumbnail field **************************     
$pic = GUICtrlCreatePic (@ScriptDir & '\wiki2.jpg', 212, 75 , 90, 90, -1, $SS_WHITEFRAME )
;GUICtrlSetTip(-1, 'Ordner mit den hochzuladenden Bildern auswählen')
    $gif = @ScriptDir & '\wiki2.jpg'
;_SetGifImage($GUIActiveX, $oIE, $gif, 212, 75, $pwidth, $pheight, 1)
;*****************************************************************************      
$c02 = GUICtrlCreateLabel('Bild in Bearbeitung', 20, 75, 190, 20)
$c03 = GUICtrlCreateCombo('', 20, 90, 190, 80)
$c04 = GUICtrlCreateLabel('Maße', 20, 118, 27, 15)
$c05 = GUICtrlCreateInput (' ', 50, 115, 80, 20, $ES_READONLY)
        GUICtrlCreateLabel('%', 135, 118, 10, 20)
$prg = GUICtrlCreateProgress (145,115,64,20,$PBS_SMOOTH)
$c06 = GUICtrlCreateLabel ('Status Textbausteine', 20, 145, 100, 20)
$b03 = GUICtrlCreateButton ('', 150,140,25,25, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 4)
        GUICtrlSetTip(-1, 'Bildpfad in den Zwischenspeicher')   
$b04 = GUICtrlCreateButton ('', 184,140,25,25, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 2)
        GUICtrlSetTip(-1, 'Bildangaben in den Zwischenspeicher')    

GUICtrlCreateGroup ( 'Angaben zum Bild', 15, 170, 290, 345)
       GUICtrlCreateLabel ('Beschreibung', 22, 185, 100, 15)
$eBs = GUICtrlCreateEdit ('', 22, 200, 275, 30, $ES_MULTILINE)
       GUICtrlCreateLabel ('Urheber', 22, 230, 100, 15)
$eUh = GUICtrlCreateEdit ('', 22, 245, 275, 30, $ES_MULTILINE)
       GUICtrlCreateLabel ('Anmerkungen', 22, 275, 100, 15)
$eAm = GUICtrlCreateEdit ('', 22, 290, 275, 30, $ES_MULTILINE)
       GUICtrlCreateLabel ('Quelle', 22, 320, 100, 15)
$eQl = GUICtrlCreateEdit ('', 22, 335, 275, 30, $ES_MULTILINE)
       GUICtrlCreateLabel ('Seite/n', 180, 320, 35, 15)
$eSt = GUICtrlCreateInput ('', 217, 320, 80, 15)
       GUICtrlCreateLabel ('Genehmigung', 22, 365, 100, 15)
$b05 = GUICtrlCreateButton ('', 280, 365, 16, 16, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 9, 0)
        GUICtrlSetTip(-1, 'Andere Genehmigungsart laden')          
$eGn = GUICtrlCreateEdit ('', 22, 380, 275, 60, $ES_MULTILINE)
       GUICtrlCreateLabel ('Andere Versionen', 22, 440, 100, 15)
$eAV = GUICtrlCreateInput ('', 22, 455, 245, 20)
$b06 = GUICtrlCreateButton ('', 273, 452, 24, 24, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 5)
        GUICtrlSetTip(-1, 'Duplikate manuell finden')   
       GUICtrlCreateLabel ('Datum', 22, 475, 100, 15)
$eDt = GUICtrlCreateInput (@MDay & '.' & @Mon & '.' & @Year, 22, 490, 245, 20)      


$tab1=GUICtrlCreateTabitem ('Einstellungen')
;GUICtrlSetState(-1,$GUI_SHOW)

$pic = GUICtrlCreatePic ( @ScriptDir & '\wiki2.jpg', 210, 45 , 90, 90, -1, $SS_WHITEFRAME )
        GUICtrlCreateGroup( 'Inhalt der Felder zurücksetzen', 15, 35, 290, 160)
$d01 = GUICtrlCreateCheckbox ('Beschreibung', 40, 50, 110, 20)
$d02 = GUICtrlCreateCheckbox ('Urheber', 40, 70, 110, 20)
$d03 = GUICtrlCreateCheckbox ('Anmerkungen', 40, 90, 110, 20)
$d04 = GUICtrlCreateCheckbox ('Seite', 40, 110, 110, 20)    
$d05 = GUICtrlCreateCheckbox ('Quelle', 40, 130, 110, 20)
$d06 = GUICtrlCreateCheckbox ('Genehmigung', 40, 150, 110, 20)
$d07 = GUICtrlCreateCheckbox ('Datum', 40, 170, 110, 20)

GUICtrlCreateGroup( 'Dateinamen des Bildes', 15, 205, 290, 285)
GUICtrlCreateLabel ('Ersetzen durch', 20, 225, 280, 15)
$d08 = GUICtrlCreateCheckbox ('kleinschreiben von', 40, 240, 110, 20)
$Ksb = GUICtrlCreateCombo ('', 155,  237, 110, 80)
$k10 = GUICtrlCreateButton ('', 267, 241, 16, 16, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 11, 0)
        GUICtrlSetTip(-1, 'In Liste aufnehmen') 
$k11 = GUICtrlCreateButton ('', 285, 241, 16, 16, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 12, 0)
        GUICtrlSetTip(-1, 'Aus Liste löschen')
$d09 = GUICtrlCreateCheckbox ('Leerzeichen', 40, 260, 110, 20)
$Lze = GUICtrlCreateCombo ('', 155, 257, 110, 80)
$k12 = GUICtrlCreateButton ('', 267, 261, 16, 16, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 11, 0)
        GUICtrlSetTip(-1, 'In Liste aufnehmen') 
$k13 = GUICtrlCreateButton ('', 285, 261, 16, 16, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 12, 0)
        GUICtrlSetTip(-1, 'Aus Liste löschen') 
$d10 = GUICtrlCreateCheckbox ('von', 40, 280, 110, 20)
$von = GUICtrlCreateCombo ('', 155, 277, 110, 80)
$k14 = GUICtrlCreateButton ('', 267, 281, 16, 16, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 11, 0)
        GUICtrlSetTip(-1, 'In Liste aufnehmen') 
$k15 = GUICtrlCreateButton ('', 285, 281, 16, 16, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 12, 0)
        GUICtrlSetTip(-1, 'Aus Liste löschen') 
        GUICtrlCreateLabel ('durch', 60, 300, 60, 20)       
$drc = GUICtrlCreateCombo ('', 155, 298, 110, 80)
        GUICtrlCreateLabel ('Übertragen in', 20, 325, 120, 15)
$d11 = GUICtrlCreateCheckbox ('Beschreibung', 40, 340, 110, 20)
$d12 = GUICtrlCreateCheckbox ('Urheber', 40, 360, 110, 20)      

        GUICtrlCreateLabel ('Anhängen', 20, 385, 280, 15)
$d13 = GUICtrlCreateRadio ('vor ', 40, 400, 110, 20)
$d14 = GUICtrlCreateRadio ('nach', 40, 420, 110, 20)
$eAh = GUICtrlCreateEdit ('', 40, 440, 258, 45, $ES_MULTILINE)
GUICtrlCreateTabitem ('')


$b07 = GUICtrlCreateButton ('', 90, 525, 32, 32, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 0)
        GUICtrlSetTip(-1, 'Beenden')
$b09 = GUICtrlCreateButton ('', 129, 525, 32, 32, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 1)
        GUICtrlSetTip(-1, 'Textdatei mit den Bildangaben öffnen')
$b10 = GUICtrlCreateButton ('', 168, 525, 32, 32, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 10)
        GUICtrlSetTip(-1, 'Auf Standardeinstellungen zurücksetzen')        
$b11 = GUICtrlCreateButton ('', 240, 525, 32, 32, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 6)
        GUICtrlSetTip(-1, 'Bildangaben aufnehmen')  
$b12 = GUICtrlCreateButton ('', 279, 525, 32, 32, $BS_ICON)
        GUICtrlSetImage (-1, @ScriptDir & '\wiki.dll', 7)
        GUICtrlSetTip(-1, 'Nach Wikipedia übertragen')         
_Standard()
GUISetState ()
While 1
    Switch GUIGetMsg()


        Case $GUI_EVENT_CLOSE;OR $b07
            Exit
        Case $c01
        Case $b01
            _FolderMyPic()
        Case $b05 
            $aGni = $aGni + 1
            If $aGni > $aGn[0] then $aGni = 1
            GUICtrlSetData($eGn,$aGn[$aGni])
        Case $b06
            _Doublette()
        Case $k10
            _InListeAufnehmen($k10)
        Case $k11
            _AusDerListeLoeschen($k11)
        Case $k12
            _InListeAufnehmen($k12)
        Case $k13
            _AusDerListeLoeschen($k13)
        Case $k14
            _InListeAufnehmen($k14)
        Case $k15
            _AusDerListeLoeschen($k15)          
        Case $b10
            _Standard()
        Case $b11
            _BildAufnehmen()
    EndSwitch
Wend

Func _AusDerListeLoeschen($ID)
    $j = 1
    If $ID = $k14 then $j = 2
    For $i = 1 to $j
        Select
            Case $ID = $k11
                $Liste = $KsbAlles
                $Combo = $Ksb
            Case $ID = $k13
                $Liste = $LzeAlles
                $Combo = $Lze   
            Case $ID = $k15
                If $i = 1 then $Liste = $VonAlles
                If $i = 1 then $Combo = $Von    
                If $i = 2 then $Liste = $DrcAlles
                If $i = 2 then $Combo = $Drc                
        EndSelect
        $Liste  = StringReplace($Liste, GUICtrlRead ($Combo),'')
        $Liste  = StringReplace($Liste, '||','|')
        If StringLeft($Liste, 1) = '|' Then $Liste  = StringTrimLeft($Liste, 1)
        If StringRight($Liste, 1) = '|' Then $Liste  = StringTrimRight($Liste, 1)       
        GUICtrlSetData($Combo,'','')
        GUICtrlSetData($Combo,$Liste,'')    
        Select
            Case $ID = $k10
                 $KsbAlles = $Liste
            Case $ID = $k12
                 $LzeAlles = $Liste
            Case $ID = $k14
                 If $i = 1 then $VonAlles = $Liste
                 If $i = 2 then $DrcAlles = $Liste
        EndSelect
    Next
    MsgBox(4160,'Hinweis','Der Eintrag wurde erfolgreich entfernt', 2)
EndFunc 

Func _BildAufnehmen()
    $Bdatei = '"' & GUICtrlRead($c01) & '\' GUICtrlRead($c02) & '"'
    $Urhebe = GUICtrlRead($eUh)
    $Anmerk = GUICtrlRead($eAm)
    $Seiten = GUICtrlRead($eSt) 
    $Beschr = GUICtrlRead($eBs)
    $Urhebe = GUICtrlRead($eUh)
    $Anmerk = GUICtrlRead($eAm)
    $Seiten = GUICtrlRead($eSt)
    $Quelle = GUICtrlRead($eQl)
    $Genehm = GUICtrlRead($eGn)
    $andere = GUICtrlRead($eAV)

    $Ini = @ScriptDir & '\wikifill.ini'
    $BigY = $BigY + 1
    $e = IniWrite($ini, $BigY, 'Pfad', $Bdatei)
    $Cache[$BigY][0] = $Bdatei
    $e = IniWrite($ini, $BigY, 'Bildeinfuegen', '[Bild:' & GUICtrlRead($c03) & _
    'thumb|left|' & $Beschr & ']]')
    $Cache[$BigY][1] = '[Bild:' & GUICtrlRead($c03) & _
    'thumb|left|' & $Beschr & ']]'      
    $e = IniWrite($ini, $BigY, 'Bildangaben', Chr(123) & Chr(123) & 'Information' & @CRLF & _
        '|Beschreibung=' & $Beschr  & @CRLF & _
        '|Quelle=' & $Quelle  & ' S.' & $Seiten & @CRLF & _
        '|Urheber=' & $Urhebe  & @CRLF & _
        '|Datum=' & @CRLF & _
        '|Genehmigung=' & $Genehm & @CRLF & _
        '|Andere Versionen=' & $andere & @CRLF & _
        '|Anmerkungen= ' &  $Anmerk & @CRLF & _
        Chr(125) & Chr(125)
        $Cache[$BigY][1] = Chr(123) & Chr(123) & 'Information' & @CRLF & _
        '|Beschreibung=' & $Beschr  & @CRLF & _
        '|Quelle=' & $Quelle  & ' S.' & $Seiten & @CRLF & _
        '|Urheber=' & $Urhebe  & @CRLF & _
        '|Datum=' & @CRLF & _
        '|Genehmigung=' & $Genehm & @CRLF & _
        '|Andere Versionen=' & $andere & @CRLF & _
        '|Anmerkungen= ' &  $Anmerk & @CRLF & _
        Chr(125) & Chr(125)
EndFunc

Func _ComboWiz($sEntry)
    $sMyPic = $sEntry & '|' & $sMyPic
    GUICtrlSetData($c01,'','')
    GUICtrlSetData($c01,$sMyPic, $sEntry)
EndFunc 

Func _Doublette()
    $Dbl = FileOpenDialog ( 'Andere Versionen eines Bildes suchen', $sMyPic, 'Bilder (*.jpg;*.gif; *.png)', 3)
    If NOT @error Then
        $aDbl = StringSplit($Dbl,'\')
        $Dbl = $aDbl[$aDbl[0]]
        GUICtrlSetData($eAV, $Dbl)
    EndIf
EndFunc

Func _FolderMyPic() 
    $cPic = ''
    Global $fPic[101][2] 
    $sWahl = FileSelectFolder ( 'Ordner der hochzuladenden Bilder', '' , 7 , $sMyPic )
    If NOT @error then _ComboWiz($sWahl)
    RunWait(@ComSpec & ' /c ' & 'dir "' & $sWahl & '\*.jpg";"' & $sWahl & '\*.gif";"' & $sWahl & '\*.png" /B > "' &  @ScriptDir & '\dir.tmp"','', @SW_HIDE)
    $h1 = FileOpen(@ScriptDir & '\dir.tmp',0)
    $iMax = 0
    For $i = 1 to 101
        $sZeile = FileReadLine($h1, $i)
        If @error = -1 Then ExitLoop
        $iMax = $iMax + 1
        $aPic[$i] = $sWahl & '\' & $sZeile
        $fPic[$i][0] = $sZeile
        $cPic = $cPic  & $sZeile & '|' 
    Next
    FileClose($h1)
    FileDelete(@ScriptDir &'\dir.tmp')
    $cPic = StringTrimRight($cPic, 1)   
    $fPic[0][0] = $iMax
    $aPic[0] = $iMax
    ReDim $aPic[$iMax + 1]
    GUICtrlSetImage (10, $aPic[1])
    GUICtrlSetData($c03,'','')
    Sleep(200)
    $y=GUICtrlSetData($c03, $cPic, $fPic[1][0])
    $gif=$aPic[1]
    _SetGifImage($GUIActiveX, $oIE, $gif, 0, 0, $pwidth, $pheight, 1)
    GUICtrlSetData($c05,$pwidth & ' x ' & $pheight & ' Px')         
    _ZeichenfuerZeichen($fPic[1][0])
EndFunc

Func _InListeAufnehmen($ID)
    $j = 1
    If $ID = $k14 then $j = 2
    For $i = 1 to $j
        Select
            Case $ID = $k10
                $Liste = $KsbAlles
                $Combo = $Ksb
            Case $ID = $k12
                $Liste = $LzeAlles
                $Combo = $Lze   
            Case $ID = $k14
                If $i = 1 then $Liste = $VonAlles
                If $i = 1 then $Combo = $Von    
                If $i = 2 then $Liste = $DrcAlles
                If $i = 2 then $Combo = $Drc                
        EndSelect
        $d = GUICtrlRead ($Combo)
        $Liste  = $Liste  & '|' & $d
        If StringLeft($Liste, 1) = '|' Then $Liste  = StringTrimLeft($Liste,1)
        GUICtrlSetData($Combo,'','')
        GUICtrlSetData($Combo,$Liste,'')    
        Select
            Case $ID = $k10
                 $KsbAlles = $Liste
            Case $ID = $k12
                 $LzeAlles = $Liste
            Case $ID = $k14
                 If $i = 1 then $VonAlles = $Liste
                 If $i = 2 then $DrcAlles = $Liste
        EndSelect
    Next
    MsgBox(4160,'Hinweis','Der Eintrag wurde erfolgreich in die Liste aufgenommen.', 2)
EndFunc 

Func _Pic()
    For $i = 1 to $aPic[0]
        GuiCtrlCreateListViewItem($aPic[$i], $lvw)
    Next
EndFunc

Func _Standard()
    $KsbAlles = 'von | zu | aus | und | zum | vom '
    $LzeAlles = '_|{Grossbuchstabe}'
    $sMyPic=RegRead('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','My Pictures')
    GUICtrlSetData($c01,$sMyPic,$sMyPic)
    GUICtrlSetData($eGn,$aGn[1])
    $aAus = StringSplit('d01|d02|d05|d06|d07|d10|d11|d13|d14','|')
    $aEin = StringSplit('d03|d04|d08|d09|d12|','|')
    For $i= 1 to $aAus[0]
        $aus = Eval($aAus[$i])
        GUICtrlSetState ($aus, $GUI_UNCHECKED)
        If $i <= $aEin[0] then
            $ein = Eval($aEin[$i])
            GUICtrlSetState ($ein, $GUI_CHECKED)
        EndIf
    Next
    GUICtrlSetData($Ksb, '', '')
    GUICtrlSetData($Ksb, $KsbAlles, '')
    GUICtrlSetData($Lze, '', '')    
    GUICtrlSetData($Lze, $LzeAlles, '') 
    GUICtrlSetData($von, '', '')
    GUICtrlSetData($drc, '', '')
EndFunc

Func _ZeichenfuerZeichen($s)
    $Scrib=''
    For $i = 1 to 5
        If StringMid($s,StringLen($s) - $i, 1) = '.' then
            $s = StringTrimRight ($s, $i +1)
            ExitLoop
        EndIf
    Next    
    If GUICtrlRead($d08)= 1 Then
        $SChr = StringSplit($LzeAlles, '|')
        For $i = 1 to StringLen($s)
            $Char = StringMid($s,$i,1)
            For $j = 1 to $Schr[0]
                If $SChr[$j] = '{Grossbuchstabe}' Then 
                    If StringIsUpper($Char)= 1 Then $Char = ' ' & $Char
                Else
                    If $SChr[$j] =  $Char Then $Char = ' '  
                EndIf   
            Next
            $Scrib=$Scrib & $Char
        Next
        $s = $Scrib
    EndIf
    
    If GUICtrlRead($d07)= 1 Then
        $af = StringSplit($KsbAlles, '|')   
        For $i = 1 to $af[0]
            $s = StringReplace($s, $af[$i], $af[$i])
        Next
        
        Do
            If StringLeft($s,1) = Chr(32) then $s = StringTrimLeft($s,1)
        Until StringLeft($s, 1) <> ' '
    EndIf
    
    If GUICtrlRead($d09)= 1 Then
        $aVo = StringSplit($VonAlles, '|')
        $aDr = StringSplit($DrcAlles, '|')      
        For $i = 1 to $aVo[0]
            $s = StringReplace($s, $aVo[$i], $aDr[$i])
        Next
    EndIf
    
    If GUICtrlRead($d12)= 1 Then $s = GUICtrlRead($eAh) & $s 
    If GUICtrlRead($d13)= 1 Then $s = $s & GUICtrlRead($eAh)
    If GUICtrlRead($d11)= 1 Then GUICtrlSetData($eUh, $s)
    If GUICtrlRead($d10)= 1 Then GUICtrlSetData($eBs, $s)   
    Return $s
EndFunc


Func _XGUICtrlComboGetCurSel($h_combobox)
    If IsHWnd($h_combobox) Then
        Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_combobox, "int", $CB_GETCURSEL, "int", 0, "int", 0)
        Return $a_ret[0]
    Else
        Return GUICtrlSendMsg($h_combobox, $CB_GETCURSEL, 0, 0)
    EndIf
EndFunc   

Func _SetGifImage(ByRef $GUIActiveX, ByRef $oIE, ByRef $gif, $x = 212, $y = 75, $pwidth = 90, $pheight = 90, $center = 0)
    GUISetState(@SW_LOCK)
    GUICtrlDelete($GUIActiveX)
    _GetGifPixWidth_Height($gif, $pwidth, $pheight)
    If $center Then 
        $x = 212 + 45 - ($pwidth/2)
        $y = 75 + 45 - ($pheight/2)
    EndIf
    $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"
    GUISetState(@SW_UNLOCK)
EndFunc;==>_SetGifImage

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

wik.zip

post-133-1167252647_thumb.jpg

Edited by jlorenz1

Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites



You've posted a ton of topics about this simple problem.

Stop creating new topics for the same problem.

People have told you to stop posting seperate topics for this one problem multiple times.

Sorry for not being of any help on the matter, but seriously, man - Stop.


Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

Yeah, I think I 've found the solution finally.

First : GIF, JPG and PNG are not the same type of files. For each one I must estimate their width and their height.

Second: GUICtrlCreateObj isn't GUICtrlCreatePic, which adapt automatically the size of picture to the control.

So I must resize it for myself.

It's too late, to show the solution. Perhaps tomorrow.Johannes :P


Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0