#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>
#include <File.au3>
#include <file.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
Global $PosCaret = 0, $hListView1, $hGui3,$INDEX_LIST, $PosCaret = 0, $hListView, $hListView1
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hGui3 = GUICreate("Выберите файл", 408, 333, -1, -1)
$hListView1 = GUICtrlCreateListView("", 8, 8, 186, 270)
$PicCoverPreView = GUICtrlCreatePic("", 200, 8, 200, 270, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Button_SC_1 = GUICtrlCreateButton("Ok", 328, 300, 75, 25, $WS_GROUP)
$Button_SC_2 = GUICtrlCreateButton("Отмена", 248, 300, 75, 25, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("", 0, 292, 426, 2, $SS_ETCHEDHORZ)
_GUICtrlListView_AddColumn($hListView1, "[Обложка]", 200)
$aCoverList = _FileListToArray(@WindowsDir, '*.exe', 1) ; Фильтр файлов
;~ _ArrayDisplay($aCoverList)
$hImage = _GUIImageList_Create()
For $i = 0 To UBound($aCoverList) - 1
$a001 = StringSplit($aCoverList[$i], '|')
_GUICtrlListView_AddItem($hListView1, $a001[1], $i)
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView1, 0x147a0d, 16, 16))
$PosCaret = $i
Next
_GUICtrlListView_SetImageList($hListView1, $hImage, 1)
_GUICtrlListView_SetItemSelected($hListView1, $PosCaret)
_GUICtrlListView_SetItemParam($hListView, $PosCaret, 1234)
$tInfo = DllStructCreate($tagLVFINDINFO)
DllStructSetData($tInfo, "Flags", $LVFI_PARAM)
DllStructSetData($tInfo, "Param", 1234)
$iI = _GUICtrlListView_FindItem($hListView1, -1, $tInfo)
_GUICtrlListView_EnsureVisible($hListView1, $iI)
_GUICtrlListView_DeleteItem($hListView1, 0)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Button_SC_2
Exit
Case $Button_SC_1
MsgBox(0, '', 'Запускаем! = ' & _GUICtrlListView_GetItemText($hListView1, $INDEX_LIST))
Run(@WindowsDir & '\' & _GUICtrlListView_GetItemText($hListView1, $INDEX_LIST))
EndSwitch
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $hWndListView1, $tInfo
$hWndListView = $hListView
$hWndListView1 = $hListView1
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
If Not IsHWnd($hListView1) Then $hWndListView1 = GUICtrlGetHandle($hListView1)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView1
Switch $iCode
Case $NM_CLICK
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$INDEX_LIST = DllStructGetData($tInfo, "Index")
Case $NM_DBLCLK
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$INDEX_LIST = DllStructGetData($tInfo, "Index")
MsgBox(0, '', 'Запускаем! = ' & _GUICtrlListView_GetItemText($hListView1, $INDEX_LIST))
Run(@WindowsDir & '\' & _GUICtrlListView_GetItemText($hListView1, $INDEX_LIST))
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY