#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Global $list, $bots
GUICreate("GUI",300,300)
$list = GUICtrlCreateListView( "Name", 10, 10, 200, 100 )
$bots = GUICtrlCreateListViewItem( 'New', $list)
$bots = GUICtrlCreateListViewItem( 'New1', $list)
$bots = GUICtrlCreateListViewItem( 'New2', $list)
$box = GUICtrlCreateInput ( "", 10, 145, 200,20)
GUISetState()
GUIRegisterMsg(0x004E, 'WM_NOTIFY')
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iCode, $tNMHDR, $tInfo
If Not IsHWnd($list) Then $list = GUICtrlGetHandle($list)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, 'hWndFrom'))
$iCode = DllStructGetData($tNMHDR, 'Code')
Switch $hWndFrom
Case $list
Switch $iCode
Case $NM_CLICK
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$iItem = DllStructGetData($tInfo, 'Index')
; $iItem=_GUICtrlListView_GetSelectedIndices($list)
$ItemText = _GUICtrlListView_GetItemText($list, $iItem)
GUICtrlSetData($box, $ItemText)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc