Public feed #724270

Anonymous

public text v1 · immutable
Raw Edit
·published 2007-10-03 13:44 UTC
rendered paste body
procedure WMPOpenExt(Name: string; Exts: string; Desc: string);
var
  I: Integer;
  P: Integer;
begin
  if WMPCount < (WMPOpenMaxChar - 3) then  //minus 3 because you at least need room for a '*.' and null terminating character
  begin
    if WMPOpenPresent(Name) then Exit;

    //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
      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;