Innosetup 读写注册表,读写INI文件

一.innosetup读写注册表

        1.注册表读写字符串 (RegQueryStringValue,RegWriteStringValue)

        RegQueryStringValue(HKEY_CURRENT_USER, 'SOFTWARE\SODA', 'appversion',         appversion)

         RegWriteStringValue(HKEY_CURRENT_USER, 'SOFTWARE\SODA', 'appversion',         'soda_value');

        2.注册表读写DWORD (RegQueryStringValue,RegWriteStringValue)

        RegQueryDWordValue(HKEY_CURRENT_USER,  'SOFTWARE\SODA', 'appversion', 
        appversion)

        RegWriteDWordValue(HKEY_CURRENT_USER,  'SOFTWARE\SODA','appversion', 
        0)

        3.删除注册表某项

        RegDeleteValue(HKEY_CURRENT_USER, 'SOFTWARE\SODA', 'appversion')

二.innosetup 读写ini文件,示例展示读取ini文件, 并将字符串切割后写入注册表

        function RegisterSuffix(const Section, Key, Default, Filename: String): Boolean;
        var
        customSuffixArray: TArrayOfString;
        suffix:String;
        index:Integer;
        begin

                suffix := GetIniString(Section, Key, Default, Filename);
                customSuffixArray := StrSplit(suffix, ',');
                for index:=0 to GetArrayLength(customSuffixArray)-1 do
                begin

                        RegWriteStringValue(HKEY_CLASSES_ROOT, '.' + customSuffixArray[index], '',                         'SODA');
                end;

                Result := true;
        end;

你可能感兴趣的:(QT基础开发,window)