讀寫配置文件

 procedure CurStepChanged(CurStep: TSetupStep);

 var

   setupName: String;

   iniPath: String;

 begin

   case CurStep of

     ssInstall: //複製文件前

     begin

     end;

     ssPostInstall:   //完成複製

     begin

       //將安裝程序名稱寫入配置文件

       iniPath := ExpandConstant('{app}'+'/option.ini');

       setupName := ExtractFileName(ExpandConstant('{srcexe}')); 

       SetIniString('setup', 'name', setupName, iniPath);

     end;

     ssDone:  //安裝完成

     begin

     end;

   end;

 end;

 

 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);

 var

   iniPath: String;

   typeRegister: String;

   url: String;

 begin

   case CurUninstallStep of

     usUninstall:

       begin

       end;

     usPostUninstall:

       begin

  //讀取註冊信息,生成url

          iniPath := ExpandConstant('{userappdata}'+'/User.bin');

          typeRegister := GetIniString('RegInfo', 'ProductType', 'trial', iniPath);

          url := 'http://www.aaaa.com/uninstall.htm?type=' + typeRegister;

          if UsingWinNT=True then

            ShellExec('open', url, '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);

       end;

   end;

 end;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章