标题:QSettings 读取注册表(中文)
作者:介农酥
日期:2022-02-25 09:41
内容:
可以看到路径中包含“立体定向手术计划软件”,读取的方式如下
SoftwareInfo GLTool::getSoftwareInfo()
{
SoftwareInfo info;
QSettings reg("HKEY_LOCAL_MACHINE\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\立体定向手术计划软件", QSettings::NativeFormat); //WOW6432Node是因为32为安装程序写注册表时被重定向了
//QString version = reg.value("DisplayVersion").toString();
QStringList keyList = reg.childKeys();
info.versionRelase = reg.value("DisplayVersion").toString();
info.versionComplete = "1.0.0"; //目前程序写死
info.installationDateTime = reg.value("InstallationDate").toString();
return info;
}
读取不出来,如果读取纯英文路径下的键和值是可以正常的读的,为什么
#1 [20091001753 02-27 13:29]
一般,注册表的 Key、路径,都是英文的,值可以是中文的。
#2 [介农酥 02-28 09:38]
但是中文路径可以写到注册表中,微软就是让人无语。谢谢你的回答。