Public feed #726246

Stuff

public text v1 · immutable
Raw Edit
·published 2007-10-05 00:29 UTC
rendered paste body
procedure WMPOpenPresent(Ext: string);
var
  WMPNum: TArrayOfString;
  WMPExt: string;
  I: Integer;
  P: Integer;
begin
  Ext := ';' + Ext + ';';
  if RegGetValueNames(HKLM, PlayerExts + 'Types', WMPNum) then
    for I := 0 to GetArrayLength(WMPNum)-1 do
    begin
      if RegQueryStringValue(HKLM, PlayerExts + 'Types', WMPNum[I], WMPExt) and (WMPExt <> '') then
      begin
        WMPExt := ';' + WMPExt + ';';
        P := Pos(Ext, Lowercase(WMPExt));
        MsgBox('Ext is currently: ' + Ext + #13#10 +
               'WMPExt is currently: ' + WMPExt + #13#10 +
               'P is currently: ' + IntToStr(P), mbinformation, mb_ok);

        if P > 0 then
        begin
          WMPCount := WMPCount - Length(WMPExt) - 1;

          while P > 0 do
          begin
            Delete(WMPExt, P, Length(Ext) - 1);
            P := Pos(Ext, Lowercase(WMPExt));
          end;

          while (Length(WMPExt) > 0) and (WMPExt[1] = ';') do
            Delete(WMPExt, 1, 1);

          while (Length(WMPExt) > 0) and (WMPExt[Length(WMPExt)] = ';') do
            Delete(WMPExt, Length(WMPExt), 1);

          if WMPExt = '' then
            if RegDeleteValue(HKLM, PlayerExts + 'Types', WMPNum[I]) then
            begin
              RegDeleteValue(HKLM, PlayerExts + 'Descriptions', WMPNum[I]);
              RegDeleteValue(HKLM, PlayerExts + 'MUIDescriptions', WMPNum[I]);
            end
          else
          begin
            RegWriteStringValue(HKLM, PlayerExts + 'Types', WMPNum[I], WMPExt);
            WMPCount := WMPCount + Length(WMPExt) + 1;
          end;
        end;
      end;
    end;
end;