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

发布时间:2024年01月14日

一.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;

文章来源:https://blog.csdn.net/cs821984831/article/details/135584911
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。