Tham khảo tài liệu 'giáo trình how to use autoit a professional manner part 56', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | SstLvi DllStructCreate uint int int uint uint ptr int int int int DllStructSetData SstLvi 1 SLVIF_TEXT DllStructSetData stLvi 2 SnIndex DllStructSetData stLvi 3 SnColumn DllStructSetData stLvi 6 DllStructGetPtr SstBuffer DllStructSetData SstLvi 7 260 GUICtrlSendMsg SnCtrlID SLVM_GETITEMA 0 DllStructGetPtr SstLvi SsItemText DllStructGetData SstBuffer 1 SstLvi 0 SstLvfi 0 SstBuffer 0 Return SsItemText EndFunc GetSubItemText . Example 2 - sorting with selfcreated items by DllCall . Func Example2 Local ShGUI Slv Smsg SnCurCol -1 SnSortDir 1 SbSet 0 SnCol -1 ShGUI GUICreate Test 300 200 Slv GUICtrlCreateListView Column1 Col2 Col3 10 10 280 180 GUICtrlRegisterListViewSort -1 LVSort2 Register the function SortLV for the sorting callback MyGUICtrlCreateListViewItem ABC 666 Slv -1 MyGUICtrlCreateListViewItem DEF 444 Slv -1 MyGUICtrlCreateListViewItem CDE 444 lv -1 GUISetState While 1 msg GUIGetMsg Switch msg Case GUI_EVENT_CLOSE ExitLoop Case lv bSet 0 nCurCol nCol GUICtrlSendMsg lv LVM_SETSELECTEDCOLUMN GUICtrlGetState lv 0 DllCall int InvalidateRect hwnd ControlGetHandle hGUI lv int 0 int 1 EndSwitch WEnd EndFunc Example2 Our sorting callback funtion Func LVSort2 hWnd nItem1 nItem2 nColumn Local nSort val1 val2 nResult Switch the sorting direction If nColumn nCurCol Then If Not bSet Then nSortDir nSortDir - 1 bSet 1 EndIf Else nSortDir 1 EndIf nCol nColumn val1 GetSubItemText hWnd nItem1 nColumn val2 GetSubItemText hWnd nItem2 nColumn If it is the 3rd colum column starts with 0 then compare the dates If SnColumn 2 Then Sval1 StringRight Sval1 4 StringMid Sval1 4 2 StringLeft Sval1 2 Sval2 StringRight val2 4 StringMid val2 4 2 StringLeft val2 2 EndIf SnResult 0 No change of item1 and item2 positions If Sval1 Sval2 Then SnResult -1 Put item2 before item1 Elself Sval1 Sval2 Then SnResult 1 Put item2 behind item1 EndIf SnResult SnResult SnSortDir Return SnResult EndF unc LV S ort2 Retrieve the text of a listview item in a specified