P := 0; 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++; end; if (P > 0) and (I <= Length(Exts)) then Delete(Exts,P,Length(Exts) - P + 1);