ale1981, Try doing it this way:
#include <GUIConstantsEx.au3>
#include <GUIListView.au3>
#include <Misc.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("Test", 400, 400)
$btn = GUICtrlCreateButton( "", 150, 50, 75, 20 )
$cInput = GUICtrlCreateInput( "", 10, 50, 100, 20 )
GUISetState()
GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" )
Global $idListview, $packersGUI, $cDummy
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $btn
listpackers()
EndSwitch
WEnd
Func listPackers()
$packersGUI = GUICreate( "Packers List", 300, 300, -1, -1, $WS_SYSMENU )
$idListview = GUICtrlCreateListView( "", 2, 2, 294, 268 )
$cDummy = GUICtrlCreateDummy() ; Create dummy control
GUISetState( @SW_SHOW )
Local $packerList[2][2] = [[1, "Name1"],[2, "Name2"]]
; Add columns
_GUICtrlListView_AddColumn( $idListview, "Packer ID", 75 )
_GUICtrlListView_AddColumn( $idListview, "Packer Name", 150 )
_GUICtrlListView_SetItemCount( $idListview, 3 )
_GUICtrlListView_AddArray( $idListview, $packerList )
_GUICtrlListView_DeleteItem( $idListview, 0 )
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $cDummy ; When dummy fired
$iIndex = GUICtrlRead($cDummy) ; Read index
GUICtrlSetData( $cInput, _GUICtrlListView_GetItemText($idListview, $iIndex) ) ; Get data into input
ExitLoop
EndSwitch
WEnd
GUIDelete($packersGUI)
EndFunc
Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $wParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $iIDFrom
Case $idListview
Switch $iCode
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
GUICtrlSendToDummy($cDummy, DllStructGetData($tInfo, "Index")) ; Fire dummy and set index value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Now you only delete the GUI in the main script and not in the message handler. M23