При выполнении операции сортировки в ListView иконки остаются на месте
Как обеспечить их привязку к типу файла ,а не к индексу Item ?
Код:

#include <GuiConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
$Gui = GUICreate("Test", 300, 200)
$hListView = _GUICtrlListView_Create($GUI, "Items|SubItems", 2, 2, 296, 196, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
$hImage = _GUIImageList_Create (16,16,5); 5-ФОН ОКНА
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3);Папка -0
_GUIImageList_AddIcon ($hImage, "shell32.dll", 0);Текстовый файл -2
_GUICtrlListView_SetImageList ($hListView, $hImage, 1)
$ListItem1 = _GUICtrlListView_AddItem($hListView, "Item1",0)
$ListItem2 = _GUICtrlListView_AddItem($hListView, "Item2",1)
$ListSubItem1 = _GUICtrlListView_AddSubItem ($hListView, 0,'1', 1)
$ListSubItem1 = _GUICtrlListView_AddSubItem ($hListView, 1,'2', 1)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
Global $B_DESCENDING[_GUICtrlListView_GetColumnCount ($hListView) ];Кол-во колонок
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; Клик по колонке
Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_GUICtrlListView_SimpleSort ($hWndListView, $B_DESCENDING, DllStructGetData($tInfo, "SubItem"))
Case $LVN_BEGINLABELEDIT
Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
Return False
Case $LVN_ENDLABELEDIT
Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
If StringLen(DllStructGetData($tBuffer, "Text")) Then Return True
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc