Function Reference


_GUICtrlListView_GetImageList

Retrieves the handle to an image list used for drawing listview items

#include <GuiListView.au3>
_GUICtrlListView_GetImageList ( $hWnd, $iImageList )

Parameters

$hWnd Control ID/Handle to the control
$iImageList Image list to retrieve:
0 - Image list with large icons
1 - Image list with small icons
2 - Image list with state images

Return Value

Success: the handle to the specified image list.
Failure: 0.

Related

_GUICtrlListView_SetImageList

Example

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $hImage, $idListview

    GUICreate("ListView Get Image List", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Load images
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($idListview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Column 1", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 2", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Item 1", 0)
    _GUICtrlListView_AddItem($idListview, "Item 2", 1)
    _GUICtrlListView_AddItem($idListview, "Item 3", 2)

    ; Get image list handle
    MsgBox($MB_SYSTEMMODAL, "Information", "Image List Handle: 0x" & Hex(_GUICtrlListView_GetImageList($idListview, 1)) & @CRLF & _
            "IsPtr = " & IsPtr(_GUICtrlListView_GetImageList($idListview, 1)) & " IsHWnd = " & IsHWnd(_GUICtrlListView_GetImageList($idListview, 1)))

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example