var I: Integer; Found: Boolean; begin I := StartIndex; if (Find = ifExactString) or (Find = ifPartialString) then begin repeat if (I = FIDList.Count-1) then if Wrap then I := 0 else Exit; Found := Pos(UpperCase(FindString), UpperCase(ShellItem(I)^.DisplayName)) = 1;//是不是这里,要先判断findstring不等于空格转化的string; Inc(I); until Found or (I = StartIndex); if Found then Index := I-1; end;
在borland的官方论坛已经给出了修正了。可以这样改:begin I := StartIndex; if (Find = ifExactString) or (Find = ifPartialString) then begin repeat // if (I = FIDList.Count-1) then // Remove this line if I >= FIDList.Count then if Wrap then I := 0 else Exit; Found := Pos(UpperCase(FindString), UpperCase(ShellItem(I)^.DisplayName)) = 1; Inc(I); until Found or (I = StartIndex); if Found then Index := I-1; end; end;
I: Integer;
Found: Boolean;
begin
I := StartIndex;
if (Find = ifExactString) or (Find = ifPartialString) then
begin
repeat
if (I = FIDList.Count-1) then
if Wrap then I := 0 else Exit;
Found := Pos(UpperCase(FindString), UpperCase(ShellItem(I)^.DisplayName)) = 1;//是不是这里,要先判断findstring不等于空格转化的string;
Inc(I);
until Found or (I = StartIndex);
if Found then Index := I-1;
end;
I := StartIndex;
if (Find = ifExactString) or (Find = ifPartialString) then
begin
repeat
// if (I = FIDList.Count-1) then // Remove this line if I >= FIDList.Count then if Wrap then I := 0 else Exit;
Found := Pos(UpperCase(FindString), UpperCase(ShellItem(I)^.DisplayName)) = 1;
Inc(I);
until Found or (I = StartIndex);
if Found then Index := I-1;
end;
end;