procedure WMPOpenExt(Name: string; Exts: string; Desc: string); var I: Integer; P: Integer; WMPExt: string; begin if WMPCount < (WMPOpenMaxChar - 3) then //minus 3 because you at least need room for a '*.' and null terminating character begin //parses Exts input if there are too many chars and removes an extension off the end P := Length(Exts) + 1; if (WMPCount + P) > WMPOpenMaxChar then begin Exts := Exts + ';'; P := 1; for I := 1 to Length(Exts) do begin if (WMPCount + I) > WMPOpenMaxChar then Break; if Exts[I] = ';' then P := I; end; Delete(Exts, P, Length(Exts) - P + 1); end; if Exts <> '' then begin if RegQueryStringValue(HKLM, PlayerExts + 'Types', Uppercase(Name), WMPExt) and (WMPExt <> '') then begin Exts := WMPExt + ';' + Exts; WMPCount := WMPCount - Length(WMPExt) - 1; end; WMPCount := WMPCount + P; RegWriteStringValue(HKLM, PlayerExts + 'Types', Uppercase(Name), Exts); RegWriteStringValue(HKLM, PlayerExts + 'Descriptions', Uppercase(Name), Desc + ' (' + Exts + ')'); RegWriteStringValue(HKLM, PlayerExts + 'MUIDescriptions', Uppercase(Name), Desc); end; end; end;