#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListview.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 327, 505, 192, 124)
$ListView1 = GUICtrlCreateListView("Test", 8, 16, 313, 401)
$Button1 = GUICtrlCreateButton("Button1", 112, 448, 105, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

for $i = 0 to 50
    GUICtrlCreateListViewItem(Random(1,100,1), $ListView1)
next
_GUICtrlListView_RegisterSortCallBack(GUICtrlGetHandle($ListView1))

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
             _GUICtrlListView_UnRegisterSortCallBack(GUICtrlGetHandle($ListView1))
            Exit
        case $ListView1
            _GUICtrlListView_SimpleSort(GUICtrlGetHandle($ListView1), True, 0); Sortieren von 1 zu 100 / False ist das gegenteil
            ; die letzte ziffer giebt den index der col an!
    EndSwitch
WEnd