You can use an aRange index as shown here. Not tested. If this code is to work when there is no range and all rows are included, you must use an aRange index that includes all rows. But it'll be more performance optimal to use two sets of code with and without row ranges.
The aRange index must of course be added to many different places in the code.
Local $iItem_Start = 500, $iItem_End = 599, $iRange = $iItem_End - $iItem_Start + 1, $aRange[$iRange]
For $i = 0 To $iRange - 1
$aRange[$i] = $iItem_Start + $i
Next
Func __ArrayDisplay_SortArrayStruct(Const ByRef $aArray, $iCol)
;Local $iRows = UBound($aArray, $UBOUND_ROWS)
Local $iDims = UBound($aArray, $UBOUND_DIMENSIONS)
Local $tIndex = DllStructCreate("uint[" & $iRange & "]")
Local $pIndex = DllStructGetPtr($tIndex)
Local Static $hDll = DllOpen("kernel32.dll")
Local Static $hDllComp = DllOpen("shlwapi.dll")
Local $lo, $hi, $mi, $r
; Sorting by one column
For $i = 1 To $iRange - 1
$lo = 0
$hi = $i - 1
Do
$mi = Int(($lo + $hi) / 2)
If $iDims = 1 Then
$r = DllCall($hDllComp, 'int', 'StrCmpLogicalW', 'wstr', $aArray[$aRange[$i]], 'wstr', $aArray[$aRange[DllStructGetData($tIndex, 1, $mi + 1)]])[0]
Else
$r = DllCall($hDllComp, 'int', 'StrCmpLogicalW', 'wstr', $aArray[$aRange[$i]][$iCol], 'wstr', $aArray[$aRange[DllStructGetData($tIndex, 1, $mi + 1)]][$iCol])[0]
EndIf
Switch $r
Case -1
$hi = $mi - 1
Case 1
$lo = $mi + 1
Case 0
ExitLoop
EndSwitch
Until $lo > $hi
DllCall($hDll, "none", "RtlMoveMemory", "struct*", $pIndex + ($mi + 1) * 4, "struct*", $pIndex + $mi * 4, "ulong_ptr", ($i - $mi) * 4)
DllStructSetData($tIndex, 1, $i, $mi + 1 + ($lo = $mi + 1))
Next
Return $tIndex
EndFunc ;==>__ArrayDisplay_SortArrayStruct