I := 1; AddCount := 1; while I <= Length(Exts) do begin if Exts[I] = ';' then begin P := I; if (WMPCount+AddCount) = WMPOpenMaxExt then break; AddCount := AddCount + 1; end; I := I + 1; end; if I <= Length(Exts) then Delete(Exts,P,Length(Exts) - P + 1);