Public feed #722918

Mine

public text v1 · immutable
Raw Edit
·published 2007-10-02 12:50 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
    Exts := Exts + ';';  //easier to handle with semicolon at end
    P := 1;
    for I := 1 to Length(Exts) do
      if Exts[I] = ';' then
      begin
        if (WMPCount + I) > WMPOpenMaxChar then Break;
        P := I;  //semicolon counts in as null terminating character
      end;
    Delete(Exts, P, Length(Exts) - P + 1);

    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;