Inno Setup script to register File Association

Inno Setup is a really light-weight, easy to use Windows Installer - none of your heavy and complicated InstallKeeled stuff.

Here is an excerpt of an iss file, to register file associations on Windows XP, which can be a little tricky:

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  case CurUninstallStep of
    usUninstall:
      begin
        // ...insert code to perform pre-uninstall tasks here...
      end;
    usPostUninstall:
      begin
        // ...insert code to perform post-uninstall tasks here...
        // restore .log file to txtfile type, so standard text editor will open it
        RegWriteStringValue(HKCR, '.log', '', 'txtfile');
        RegWriteStringValue(HKCU, 'Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.log', 'Progid', 'txtfile');
      end;
  end;
end;

Comments