All pastes #277369 Raw Edit

Something

public text v1 · immutable
·published 2006-12-13 03:43 UTC
rendered paste body
procedure CopyOldFiletype(Ext: string; NewFiletype: string);
var
  OldType: string;
  OldIcon: string;
  OldApp: string;
begin
  if RegValueExists(HKCR, '.' + Ext, '') then
  begin
    RegQueryStringValue(HKCR, '.' + Ext, '', OldType)
    
    if RegQueryStringValue(HKCR, 'OldType', 'DefaultIcon', '', OldIcon) then
      RegWriteStringValue(HKCR, 'NewFiletype', 'DefaultIcon', '', 'OldIcon');

    if RegQueryStringValue(HKCR, 'OldType', 'shell', 'open', 'command', '', OldApp) then
      RegWriteStringValue(HKCR, 'NewFiletype', 'shell', 'open', 'command', '', 'OldApp');
  end;
end;

procedure CopyOldFiletypes;
begin
  CopyOldFiletype('mkv', 'MatroskaVideo');
  CopyOldFiletype('mka', 'MatroskaVideo');
  CopyOldFiletype('mp4', 'mp4file');
  CopyOldFiletype('ogm', 'ogmfile');
end;