{
CustomSort example
The following code orders a list view in reverse alphabetical order on the click of a button. The callback function CustomSortProc calls the global CompareText function and negates its return value.
} 
function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
begin
  Result := -CompareText(Item1.Caption,Item2.Caption);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  ListView1.CustomSort(@CustomSortProc, 0);
end; 
