function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
implementation//之前定义上面这句procedure TForm1.ListView1ColumnClick(Sender: TObject;
  Column: TListColumn);
begin
  ListData.CustomSort(@CustomSortProc, Column.Index);
end;function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
begin
  if ParamSort>0 then
    Result := CompareText(Item1.SubItems.Strings[ParamSort-1],Item2.SubItems.Strings[ParamSort-1])
  else
    Result := CompareText(Item1.Caption,Item2.Caption);
end;