Nie mogę sobie poradzić z CustomSort.
Oto relewantny fragment kodu (idea: posortowanie alfabetyczne listy plików wg nazw niezależnie od ścieżki):
procedure TForm1.ButtonGoClick(Sender: TObject);
{...}
if OpenDialog1.Execute then
begin
Process(OpenDialog1.Files as TStringList, RadioGroupFileType.ItemIndex);
{...}
end;
procedure TForm1.Process(Source: TStringList; FileType:Integer);
var
i, diff: integer;
prefix, newname: string;
begin
Source.Sorted:=False;
{...}
Source.CustomSort(@TForm1.SortNames);
{...}
end;
function TForm1.SortNames(List: TStringList; Index1, Index2: Integer): Integer;
stdcall;
begin
Result:=CompareStr(UpperCase(ExtractFileName(List[Index1])),
UpperCase(ExtractFileName(List[index2])));
end;
powyższy kod wywala Index out of bounds. Próbowałem bez stdcall, wtedy Access violation. Bardzo proszę o pomoc, możliwie szybko.