Sign in to follow this  
Followers 0
rootx

[SOLVED] ListView update image help

8 posts in this topic

#1 ·  Posted (edited)

This script creates a list of images and their description, you can also rotate images and save them in the right quality.

I would like to update the image in the Listview, when it is rotated by Gui2.
I tried to find a good solution, but without success. Could someone help me, thanks.:)

#include <APIResConstants.au3>
#include <GuiTab.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <FileConstants.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GDIPlus.au3>

 Global $hGUI2 = 1111,$hGUI1, $hButton3 ,$hButton1,$hButton2,$hButton3,$flip,$image2

_imagelist()

Func _imagelist()

    Global $inimg = @ScriptDir&"\img.ini"

    Global $idListview, $hImage

    Local $aArray2 = _FileListToArrayRec(@ScriptDir, "*.jpg", $FLTAR_FILES, 1, $FLTAR_SORT,$FLTAR_FULLPATH)
    $fileArray4 = UBound($aArray2) -1
    If $fileArray4 > 0 Then
    $hGUI1 = GUICreate("Image Album List "&$fileArray4, 800, 600)
    $idListview = GUICtrlCreateListView("", 2, 2, 800, 600, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER))

    ; block resizing of columns
    ControlDisable($hGUI1, "", HWnd(_GUICtrlListView_GetHeader($idListview)))

    GUISetState()
    ; Load images
    $hImage = _GUIImageList_Create(64, 64,5,3)
    _GUICtrlListView_SetImageList($idListview, $hImage)
    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Image", 64)
    _GUICtrlListView_AddColumn($idListview, "Path", 350)
    _GUICtrlListView_AddColumn($idListview, "Caption",365)
    ;_GUICtrlListView_HideColumn($idListview, 1)
    _GDIPlus_Startup()
    Local $GDIpBmpLarge,$GDIpBmpResized,$GDIbmp

    For $y = 1 To $fileArray4
        $ini = IniWrite($inimg,$aArray2[$y],"caption",$aArray2[$y]) ;<<< run only the first time, then put a comment
        $GDIpBmpLarge = _GDIPlus_ImageLoadFromFile($aArray2[$y]) ;GDI+ image!
        $GDIpBmpResized = _GDIPlus_ImageResize($GDIpBmpLarge, 64,64) ;GDI+ imagez
        $GDIbmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($GDIpBmpResized) ;GDI image!
        $img = _GUIImageList_Add($hImage, $GDIbmp)
        _GUICtrlListView_SetImageList($idListview, $hImage, 1)

        ;Add items
        _GUICtrlListView_AddItem($idListview, "", $img) ;load image inside listview
        _GUICtrlListView_AddSubItem($idListview, $y-1,$aArray2[$y],1)
        _GUICtrlListView_AddSubItem($idListview, $y-1,IniRead($inimg,$aArray2[$y],"caption",""),2) ;load caption inside listview
        ;Clean
        _GDIPlus_BitmapDispose($GDIpBmpLarge) ;release GDI+ image!
        _GDIPlus_BitmapDispose($GDIpBmpResized);release GDI+ image!
        _WinAPI_DeleteObject($GDIbmp);release Obj!
    Next

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

     While 1
         $aMsg = GUIGetMsg(1)
         Switch $aMsg[1]
             Case $hGUI1
                 Switch $aMsg[0]
                     Case $GUI_EVENT_CLOSE
                         ExitLoop
                         GUIDelete($hGUI1)
                 EndSwitch
             Case $hGUI2
                 Switch $aMsg[0]
                     Case $GUI_EVENT_CLOSE
                         GUIDelete($hGUI2)
                         GUICtrlSetState ($idListview,$GUI_ENABLE)
                     Case $hButton1
                         $flip = 1
                         rotate($image2,$flip)
                     Case $hButton2
                         $flip = 4
                         rotate($image2,$flip)
                     Case $hButton3
                         $flip = 6
                         rotate($image2,$flip)
                 EndSwitch
         EndSwitch
     WEnd

    ;cleanup resources
    _GDIPlus_Shutdown()
    Else
        MsgBox("","","Images folder are empty")
    EndIf
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndListView = $idListview
    If Not IsHWnd($idListview) Then $hWndListView = GUICtrlGetHandle($idListview)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    $path = IniRead("cfg.ini","PAGE","sourcedir","")
                     Local $iItemText = _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),2)
                     Local $sValue = InputBox("Edit Image", "Enter your description.", ""," M100",400,150)
                     Local $iIndex = _GUICtrlListView_GetSelectedIndices($idListview)
                     _GUICtrlListView_SetItemText($idListview,$iIndex,$sValue,2)
                      If $sValue <> "" Then
                         IniWrite($inimg,_GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1),"caption",$sValue)
                      Else
                          _GUICtrlListView_SetItemText($idListview,$iIndex,$iItemText,3)
                      EndIf

                Case $LVN_COLUMNCLICK ; A column was clicked
                    Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)

                    _GUICtrlListView_SortItems($idListview, _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1))

                Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    $image2 = _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1)
                    Global $colrbt = 0xFF0CAA, $colortxbt = 0xFFFFFF
                    $hGUI2 = GUICreate($image2, 800, 650, -1, -1);create a test gui to display the image
                    $hButton1 = GUICtrlCreateButton("Rotate", 10, 610, 120, 30)
                    GUICtrlSetBkColor(-1, $colrbt)
                    GUICtrlSetColor(-1,$colortxbt)
                    $hButton2 = GUICtrlCreateButton("Flip Horizontally", 140, 610, 120, 30)
                    GUICtrlSetBkColor(-1, $colrbt)
                    GUICtrlSetColor(-1,$colortxbt)
                    $hButton3 = GUICtrlCreateButton("Flip Vertically", 270, 610, 120, 30)
                    GUICtrlSetBkColor(-1, $colrbt)
                    GUICtrlSetColor(-1,$colortxbt)
                    GUISetState(@SW_SHOW)
                    rotate($image2,0)
                    GUICtrlSetState ($idListview,$GUI_DISABLE)

                    Return 0 ; allow the default processing
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func rotate($image2,$flip)
    _GDIPlus_Startup()
    Local $hImagex, $tData, $tParams
    $hImagex = _GDIPlus_ImageLoadFromFile($image2)
    $imgX = _GDIPlus_ImageGetWidth($hImagex)
    $imgY = _GDIPlus_ImageGetHeight($hImagex)
    $himage_Clone = _GDIPlus_BitmapCloneArea($hImagex, 0, 0, $imgX, $imgY,$GDIP_PXF24RGB)
    _GDIPlus_ImageDispose($hImagex)
    _GDIPlus_ImageRotateFlip($himage_Clone,$flip)
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI2) ;create a graphics object from a window handle
    $hImage_new2 = _GDIPlus_ImageResize($himage_Clone, 800,600)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hImage_new2, 0, 0) ;display rotated image

    ;Change image quality
    $clsid = _GDIPlus_EncodersGetCLSID("JPG");type
    $tParams = _GDIPlus_ParamInit(1)
    $tData = DllStructCreate("int Quality")
    DllStructSetData($tData, "Quality", 100) ;quality 0-100
    $pData = DllStructGetPtr($tData)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData)
    $pParams = DllStructGetPtr($tParams)

    ;Save the new resized image.
    _GDIPlus_ImageSaveToFileEx($himage_Clone, $image2, $clsid, $pParams)

    ;clean
    _GDIPlus_ImageDispose($himage_Clone)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_ImageDispose($hImage_new2)
    _GDIPlus_Shutdown()
EndFunc

 

Edited by rootx

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Use 

_GUIImageList_Replace

function to replace the image in the image list. The image must be in GDI format!

Btw, I don't know why this function is not in the help file although it is in GuiImageList.au3...

; #NO_DOC_FUNCTION# =============================================================================================================
; Name...........: _GUIImageList_Replace
; Description ...: Replaces an image with an icon or cursor
; Syntax.........: _GUIImageList_ReplaceIcon ( $hWnd, $iIndex, $hIcon )
; Parameters ....: $hWnd        - Handle to the control
;                  $iIndex      - Index of the image to replace.
;                  $hImage      - Handle to the bitmap that contains the image
;                  $hMask       - A handle to the bitmap that contains the mask.
;                  +If no mask is used with the image list, this parameter is ignored
; Return values .: Success      - True
;                  Failure      - False
; Author ........: Gary Frost (gafrost)
; Modified.......:
; Remarks .......: The _GUIImageList_Replace function copies the bitmap to an internal data structure.
;                  Be sure to use the _WinAPI_DeleteObject function to delete $hImage and $hMask after the function returns.
; Related .......:
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func _GUIImageList_Replace($hWnd, $iIndex, $hImage, $hMask = 0)
    Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_Replace", "handle", $hWnd, "int", $iIndex, "handle", $hImage, "handle", $hMask)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] <> 0
EndFunc   ;==>_GUIImageList_Replace

 

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

 

Thx UEZ, it should work... but obviously I'm doing something wrong :o

please look here ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> test

 

#include <APIResConstants.au3>
#include <GuiTab.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <FileConstants.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GDIPlus.au3>

 Global $hGUI2 = 1111,$hGUI1, $hButton3 ,$hButton1,$hButton2,$hButton3,$flip,$image2

_imagelist()

Func _imagelist()

    Global $inimg = @ScriptDir&"\img.ini"

    Global $idListview, $hImage

    Local $aArray2 = _FileListToArrayRec("C:\Users\rootx10\Desktop\x", "*.jpg", $FLTAR_FILES, 1, $FLTAR_SORT,$FLTAR_FULLPATH)
    $fileArray4 = UBound($aArray2) -1
    If $fileArray4 > 0 Then
    $hGUI1 = GUICreate("Image Album List "&$fileArray4, 800, 600)
    $idListview = GUICtrlCreateListView("", 2, 2, 800, 600, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER))

    ; block resizing of columns
    ControlDisable($hGUI1, "", HWnd(_GUICtrlListView_GetHeader($idListview)))

    GUISetState()
    ; Load images
    $hImage = _GUIImageList_Create(64, 64,5,3)
    _GUICtrlListView_SetImageList($idListview, $hImage)
    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Image", 64)
    _GUICtrlListView_AddColumn($idListview, "Path", 350)
    _GUICtrlListView_AddColumn($idListview, "Caption",365)
    ;_GUICtrlListView_HideColumn($idListview, 1)
    _GDIPlus_Startup()
    Local $GDIpBmpLarge,$GDIpBmpResized,$GDIbmp

    For $y = 1 To $fileArray4
        $ini = IniWrite($inimg,$aArray2[$y],"caption",$aArray2[$y]) ;<<< run only the first time, then put a comment
        $GDIpBmpLarge = _GDIPlus_ImageLoadFromFile($aArray2[$y]) ;GDI+ image!
        $GDIpBmpResized = _GDIPlus_ImageResize($GDIpBmpLarge, 64,64) ;GDI+ imagez
        $GDIbmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($GDIpBmpResized) ;GDI image!
        $img = _GUIImageList_Add($hImage, $GDIbmp)
        _GUICtrlListView_SetImageList($idListview, $hImage, 1)

        ;Add items
        _GUICtrlListView_AddItem($idListview, "", $img) ;load image inside listview
        _GUICtrlListView_AddSubItem($idListview, $y-1,$aArray2[$y],1)
        _GUICtrlListView_AddSubItem($idListview, $y-1,IniRead($inimg,$aArray2[$y],"caption",""),2) ;load caption inside listview
        ;Clean
        _GDIPlus_BitmapDispose($GDIpBmpLarge) ;release GDI+ image!
        _GDIPlus_BitmapDispose($GDIpBmpResized);release GDI+ image!
        _WinAPI_DeleteObject($GDIbmp);release Obj!
    Next

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

     While 1
         $aMsg = GUIGetMsg(1)
         Switch $aMsg[1]
             Case $hGUI1
                 Switch $aMsg[0]
                     Case $GUI_EVENT_CLOSE
                         ExitLoop
                         GUIDelete($hGUI1)
                 EndSwitch
             Case $hGUI2
                 Switch $aMsg[0]
                     Case $GUI_EVENT_CLOSE
                         GUIDelete($hGUI2)
                         GUICtrlSetState ($idListview,$GUI_ENABLE)
                     Case $hButton1
                         $flip = 1
                         rotate($image2,$flip)
                     Case $hButton2
                         $flip = 4
                         rotate($image2,$flip)
                     Case $hButton3
                         $flip = 6
                         rotate($image2,$flip)
                 EndSwitch
         EndSwitch
     WEnd

    ;cleanup resources
    _GDIPlus_Shutdown()
    Else
        MsgBox("","","Images folder are empty")
    EndIf
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndListView = $idListview
    If Not IsHWnd($idListview) Then $hWndListView = GUICtrlGetHandle($idListview)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    $path = IniRead("cfg.ini","PAGE","sourcedir","")
                     Local $iItemText = _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),2)
                     Local $sValue = InputBox("Edit Image", "Enter your description.", ""," M100",400,150)
                     Local $iIndex = _GUICtrlListView_GetSelectedIndices($idListview)
                     _GUICtrlListView_SetItemText($idListview,$iIndex,$sValue,2)
                      If $sValue <> "" Then
                         IniWrite($inimg,_GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1),"caption",$sValue)
                      Else
                          _GUICtrlListView_SetItemText($idListview,$iIndex,$iItemText,3)
                      EndIf

                Case $LVN_COLUMNCLICK ; A column was clicked
                    Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)

                    _GUICtrlListView_SortItems($idListview, _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1))

                Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    $image2 = _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1)
                    Global $colrbt = 0xFF0CAA, $colortxbt = 0xFFFFFF
                    $hGUI2 = GUICreate($image2, 800, 650, -1, -1);create a test gui to display the image
                    $hButton1 = GUICtrlCreateButton("Rotate", 10, 610, 120, 30)
                    GUICtrlSetBkColor(-1, $colrbt)
                    GUICtrlSetColor(-1,$colortxbt)
                    $hButton2 = GUICtrlCreateButton("Flip Horizontally", 140, 610, 120, 30)
                    GUICtrlSetBkColor(-1, $colrbt)
                    GUICtrlSetColor(-1,$colortxbt)
                    $hButton3 = GUICtrlCreateButton("Flip Vertically", 270, 610, 120, 30)
                    GUICtrlSetBkColor(-1, $colrbt)
                    GUICtrlSetColor(-1,$colortxbt)
                    GUISetState(@SW_SHOW)
                    rotate($image2,0)
                    GUICtrlSetState ($idListview,$GUI_DISABLE)
                    Return 0 ; allow the default processing
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func rotate($image2,$flip)
    _GDIPlus_Startup()
    Local $hImagex, $tData, $tParams
    $hImagex = _GDIPlus_ImageLoadFromFile($image2)
    $imgX = _GDIPlus_ImageGetWidth($hImagex)
    $imgY = _GDIPlus_ImageGetHeight($hImagex)
    $himage_Clone = _GDIPlus_BitmapCloneArea($hImagex, 0, 0, $imgX, $imgY,$GDIP_PXF24RGB)
    _GDIPlus_ImageDispose($hImagex)
    _GDIPlus_ImageRotateFlip($himage_Clone,$flip)
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI2) ;create a graphics object from a window handle
    $hImage_new2 = _GDIPlus_ImageResize($himage_Clone, 800,600)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hImage_new2, 0, 0) ;display rotated image

    $tParams = _GDIPlus_ParamInit(1)
    $tData = DllStructCreate("int Quality")
    DllStructSetData($tData, "Quality", 100) ;quality 0-100
    $pData = DllStructGetPtr($tData)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData)

    ;Save the new resized image.
    _GDIPlus_ImageSaveToFileEx($himage_Clone, $image2, $clsid, $pParams)

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> test
    Local $iIndex2 = _GUICtrlListView_GetSelectedIndices($idListview)
    $GDIbmpx = _GDIPlus_BitmapCreateHBITMAPFromBitmap($GDIpBmpResizedx) ;GDI image!
    _GUIImageList_ReplaceIcon($idListview, $iIndex2,$GDIbmpx)


    ;clean
    _GDIPlus_ImageDispose($himage_Clone)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_ImageDispose($hImage_new2)
    _GDIPlus_Shutdown()
EndFunc

 

 

Edited by rootx

Share this post


Link to post
Share on other sites

Try these lines and it should work:

Local $iIndex2 = _GUICtrlListView_GetSelectedIndices($idListview)
    $GDIpBmpResizedx = _GDIPlus_ImageResize($hImage_new2, 64, 64) ;GDI+ imagez
    $GDIbmpx = _GDIPlus_BitmapCreateHBITMAPFromBitmap($GDIpBmpResizedx) ;GDI image!
    _GUIImageList_Replace($hImage, $iIndex2, $GDIbmpx)

 

1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

THX UEZ, :)

Share this post


Link to post
Share on other sites

#6 ·  Posted

Hello @rootx and @UEZ

Can i develop your code like my picture attached

is It possible or impossible?
I want rename pictures like list name

1.png

Share this post


Link to post
Share on other sites

#7 ·  Posted

?? You can, try to do it, and then, post your code if you want others to help you.

Share this post


Link to post
Share on other sites

#8 ·  Posted

Local $iIndex2 = _GUICtrlListView_GetSelectedIndices($idListview)
    $GDIpBmpResizedx = _GDIPlus_ImageResize($hImage_new2, 64, 64) ;GDI+ imagez
    $GDIbmpx = _GDIPlus_BitmapCreateHBITMAPFromBitmap($GDIpBmpResizedx) ;GDI image!
    _GUIImageList_Replace($hImage, $iIndex2, $GDIbmpx)

try above

Best Collection wallpapers  at  HD Wallpapers. categories of Natural, Vehicle,Paintings and ect wallpapers and images Pictures.

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

  • Similar Content

    • Monica
      By Monica
      Hi guys!! I'm going crazy... please help me -.-
      First, open the attached screenshot. Second: I'd like to grab info from external window. The program is "Metatrader4", a tool for trading and charts analysis.
      The function _GUICtrlListView_GetItemText() return an empty string! I tried to change the index $index (the second parameter) into Number($index), as recommended by other similar posts in this forum, but this did not solve my problem 
      Well, why I'm going mad? Because in my mind an UDF approach works great or it does not work at all; instead, in my code something works and something else does not. I really don't understand why... and you?
      THXX!!!!  
      $handle=ControlGetHandle("Expert - "&$expertname,"",1383);List: Variable|Value For $i=0 To _GUICtrlListView_GetItemCount($handle)-1;WORKS!!! $temp=_GUICtrlListView_GetItemText($handle,0+$i);RETURN EMPTY STRING :-( MsgBox(0, "", $temp) $temp = _GUICtrlListView_GetItemSelected($handle,$i);WORKS!!! MsgBox(0, "", $temp) Next  

    • mLipok
      By mLipok
      I was not lucky to find the right function so I created it by my self:
      _GUICtrlListView_GetColumnID_ByName()
      Example:
       
      #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("ListView Get Column ID", 400, 300) Local $idListview = GUICtrlCreateListView("Alfa|Beta|Gama", 2, 2, 394, 268) GUISetState(@SW_SHOW) _GUICtrlListView_SetColumnOrder($idListview, "2|0|1") MsgBox($MB_SYSTEMMODAL, "Information", "Column ID: " & _GUICtrlListView_GetColumnID_ByName($idListview, 'Gama')) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func _GUICtrlListView_GetColumnID_ByName($hListView, $sColumnToFind) Local $iColumn_Count = _GUICtrlListView_GetColumnCount($hListView) Local $aColumns For $iColumn_idx = 0 To $iColumn_Count - 1 $aColumns = _GUICtrlListView_GetColumn($hListView, $iColumn_idx) If $aColumns[5] = $sColumnToFind Then Return $iColumn_idx EndIf Next Return SetError(1, 0, -1) EndFunc ;==>_GUICtrlListView_GetColumnID_ByName  
    • UEZ
      By UEZ
      Here a small tool I wrote to update my Sysinternal tools collection without the need to download always the whole package or visiting the site to check for updates. I know that there are several tools available (also some tools written in AutoIt) but here another one for the collection. It was good exercise for me to code it.
       
       
        
       
       
      Some files from cannot be downloaded although they are visible on the web site!
       
      Here the download link of the source code only: AutoIt Sysinternal Tools Synchronizer v0.99.1 build 2017-10-23 beta.7z  (1353 downloads previously)
      -=> Requires AutoIt version 3.3.13.20 or higher / tested on Win8.1 real machine and some VMs: Win7 / Vista / Win10
       
      Compiled exe only: @MediaFire
       
      Just select the Sysinternal Tools folder or create one and press the synchronize button to download the selected items. Click on AutoIt label (near to left upper corner) to open menu.
       
      Special thanks to LarsJ, Melba23 and mesale0077 for their help. 
       
      I've still some ideas to implement which are more gimmick related, so it is not finished yet...
      If you want to add your language please check out #Region Language. Thanks. 
       
      Please report any bug or if you have any suggestions.
       
      The language of the tool tip from each of the executable in the left list view were automatically created using Google translator and weren't checked for correctness.
       
      Br,
      UEZ
    • 0Ethan0
      By 0Ethan0
      Ahoy Autoit Community!
      After many trials and errors I am unable to solve a problem I am facing and would appreciate any kind of input or better yet a solution 
      The Premise: An embeded slideshow viewer that runs after double-clicking an item in a ListView (each item will generate a different slideshow images).
      The Setup: GUI with a ListView Control and a simple exit button.
      The Issue: Once double clicked the slide plays however the GUI "locks"/non responsive until the slide is over. Same thing if I click on the "Test" button.
      The Culprit: I believe since it's in the images loop it can't accept any other commands until that loop is over.
      The Wish: I want to be able to use the GUI functions (selecting other items, clicking on button etc.) while the slideshow plays.
      The Code (stripped and simplified as much as I could):
      #include <GuiListView.au3> #include <File.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) HotKeySet("{Esc}", "_Exit") Global $c=0 Global $ssGDI[3], $ssGraphic[2], $ssImage Global Const $bg_color = "000000" Global Const $ssW = 480, $ssH = 320 Global $aFiles = _FileListToArrayRec("d:\testStage\", "*.jpg;*.png;*.bmp;*.gif;*.JPG;*.PNG;*.BMP;*.GIF", $FLTAR_FILES, $FLTAR_NORECUR ,$FLTAR_SORT ,$FLTAR_FULLPATH ) $guiW = 1200 $guiH = 726 $mainWindow = GUICreate("Slideshow Viewer", $guiW, $guiH, -1, -1, $WS_POPUP) $Button1 = GUICtrlCreateButton("Exit", 0, 0, 50, 50) GUICtrlSetOnEvent($Button1, "_Exit") $Button1 = GUICtrlCreateButton("Test", 60, 0, 50, 50) GUICtrlSetOnEvent($Button1, "Test") Global $ListView = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280) _GUICtrlListView_SetColumnWidth ($ListView, 0, 100) _GUICtrlListView_SetColumnWidth ($ListView, 1, 100) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("Name 1|Category 1", $ListView) GUICtrlCreateListViewItem("Name 2|Category 2", $ListView) screenshotWidgetInit($ssW,$ssH, 690, 100) GUISetState(@SW_SHOW, $mainWindow) GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() EndSwitch WEnd Func Test() For $k = 1 To UBound($aFiles) - 1 screenshotWidgetTransition($aFiles[$k]) Next EndFunc Func ListView_Click() ConsoleWrite("Left Click") EndFunc Func ListView_DoubleClick() ConsoleWrite("Double Left Click") Test() EndFunc Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select Case $event = $NM_CLICK ListView_Click () Case $event = $NM_DBLCLK ListView_DoubleClick () EndSelect EndSelect Return $GUI_RUNDEFMSG EndFunc Func screenshotWidgetTransition($image, $delay = 0, $speed = 1, $sleep = 2000) Local $a, $d = $c, $iX, $iY $ssImage = _GDIPlus_ImageLoadFromFile($image) $iX = _GDIPlus_ImageGetWidth($ssImage) $iY = _GDIPlus_ImageGetHeight($ssImage) $FDesktop=$ssH/$ssW $Fact =1 If $iX > $ssW And $FDesktop > ($iY/$iX) Then $Fact=$ssW/$iX ElseIf $iY > $ssH Then $Fact=$ssH/$iY EndIf $H1 = Round(($Fact * $iY),0) $W1 = Round(($Fact * $iX),0) _GDIPlus_GraphicsDrawImageRect($ssGraphic[$d], $ssImage,($ssW - $W1)/2, ($ssH - $H1) / 2,$W1,$H1) WinSetTrans($ssGDI[$d], "", 0) WinSetOnTop($ssGDI[$d], "", 1) For $a = 0 To 254 Step $speed WinSetTrans($ssGDI[$d], "", $a) Sleep($delay) Next WinSetTrans($ssGDI[$d], "", 254) WinSetOnTop($ssGDI[Not ($d)], "", 0) WinSetTrans($ssGDI[Not ($d)], "", 0) _GDIPlus_GraphicsClear($ssGraphic[Not ($d)]) $c = 1 - $d _GDIPlus_ImageDispose ($ssImage) ; very important to realease the pics Sleep($sleep) EndFunc ;==>screenshotWidgetTransition Func screenshotWidgetInit($ssW,$ssH,$ssX,$ssY) $ssGDI[2] = GUICreate("", $ssW, $ssH, $ssX, $ssY, $WS_POPUP, $WS_EX_MDICHILD, $mainWindow) $ssGDI[0] = GUICreate("", $ssW, $ssH, 3, 3, $WS_POPUP, $WS_EX_MDICHILD, $ssGDI[2]) $ssGDI[1] = GUICreate("", $ssW, $ssH, 3, 3, $WS_POPUP, $WS_EX_MDICHILD, $ssGDI[2]) ; GUISetBkColor("0x" & $bg_color, $ssGDI[2]) GUISetState(@SW_SHOW, $ssGDI[2]) GUISetState(@SW_SHOW, $ssGDI[0]) GUISetState(@SW_SHOW, $ssGDI[1]) WinSetTrans($ssGDI[0], "", 0) WinSetTrans($ssGDI[1], "", 0) _GDIPlus_Startup() $ssGraphic[0] = _GDIPlus_GraphicsCreateFromHWND($ssGDI[0]) $ssGraphic[1] = _GDIPlus_GraphicsCreateFromHWND($ssGDI[1]) _GDIPlus_GraphicsClear($ssGraphic[0], "0xFF" & $bg_color) _GDIPlus_GraphicsClear($ssGraphic[1], "0xFF" & $bg_color) EndFunc ;==>screenshotWidgetInit Func _Exit() _GDIPlus_ImageDispose($ssImage) _GDIPlus_GraphicsDispose($ssGraphic[0]) _GDIPlus_GraphicsDispose($ssGraphic[1]) GUIDelete($ssGDI[0]) GUIDelete($ssGDI[1]) GUIDelete($ssGDI[2]) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit I hope someone can shed light on this; perhaps a different approach is needed?
      Thank you in advance!
      P.S.
      The script is patched from different scripts of different users in the forum - thank you again users!
    • Daka
      By Daka
      I know there are listbox and listview, but now I have?
      here is the video of infowindow 
      I tried to read mouse selection like for listbox:
      $listWindow = "[CLASS:TFormResearchGR]" $topicsList = "[CLASS:TMWrapper; INSTANCE:255]" WinWait($listWindow, "", 60) $hdlWindow = WinGetHandle($listWindow) $hdlList = ControlGetHandle($hdlWindow, "", $topicsList) _GUICtrlListBox_ClickItem($hdlList, 0, "left") $countOfList = _GUICtrlListBox_GetCount($hdlList) ConsoleWrite("Count of list: " & $countOfList & @LF) count of list is not working.
      I realiezed that there are difference between listbox and listview, but this is something different.
      and till now I never saw that you can go inside with infotool and also get instances.
       
      so Im confused how to get the list number and the names of selection?