查看完整版本: [-- Qt 读取注册表,读取错误 --]

QTCN开发网 -> Qt基础编程 -> Qt 读取注册表,读取错误 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

tfx181512 2020-06-02 14:42

Qt 读取注册表,读取错误

  1. QString strRegPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
    QSettings* pSettings = new QSettings(strRegPath, QSettings::NativeFormat);
        
    QStringList groupList = pSettings->childGroups();
    for each (QString group  in groupList)
    {
        pSettings->beginGroup(group);
        QString softwareName = pSettings->value("DisplayName", "").toString();
        
        pSettings->endGroup();
    }
    delete pSettings;
读取到的值一直是“HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall”下的,我项读取的是“HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall

dbzhang800 2020-06-02 17:45
你用的是32bit的Qt吧?换成64bit的

20091001753 2020-06-07 00:16
http://www.qtcn.org/bbs/read-htm-tid-45657.html

如果注册表的值,有斜杠或反斜杠,那么你需要用 WINAPI 来读取。

或者简单来说,读取注册表,你还是直接用 WINAPI 吧。

fsu0413 2020-06-20 18:39
20091001753:http://www.qtcn.org/bbs/read-htm-tid-45657.html
如果注册表的值,有斜杠或反斜杠,那么你需要用 WINAPI 来读取。
或者简单来说,读取注册表,你还是直接用 WINAPI 吧。 (2020-06-07 00:16)

感觉这种的带WOW6432Node的就算用Windows API也一样会被跳转吧。。。。
64位系统下32位程序的处理是在Windows API中耦合的,绕不过去

fsu0413 2020-06-20 18:45
fsu0413:感觉这种的带WOW6432Node的就算用Windows API也一样会被跳转吧。。。。
64位系统下32位程序的处理是在Windows API中耦合的,绕不过去
 (2020-06-20 18:39) 

刚看到了一种方法,也是用Windows API,不过要加flag


查看完整版本: [-- Qt 读取注册表,读取错误 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled