# Function Reference

# _GUICtrlListView_GetItemStateImage

Gets the state image that is displayed

#include <GuiListView.au3>
_GUICtrlListView_GetItemStateImage ( $hWnd, $iIndex )

## Parameters

$hWnd | Control ID/Handle to the control
$iIndex | 0-based index of the item

## Return Value

Returns the 1-based overlay image index.

## Related

_GUICtrlListView_SetItemStateImage

## Example

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

    Example()

    Func Example()
        GUICreate("ListView Get/Set Item StateImage (v" & @AutoItVersion & ")", 400, 300)
        Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
        _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
        GUISetState(@SW_SHOW)

        ; Load images
        Local $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)
        _GUICtrlListView_SetImageList($idListview, $hImage, 2)

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

        ; Add items
        _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0)
        _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1)
        _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2)
        _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1)
        _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1)
        _GUICtrlListView_AddItem($idListview, "Row 3: Col 1", 2)

        ; Set item 2 state image
        _GUICtrlListView_SetItemStateImage($idListview, 1, 1)
    ;~  MsgBox($MB_SYSTEMMODAL, "Information", "Item 2 State Image: " & _GUICtrlListView_GetItemStateImage($idListview, 1))

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