Read window's registry in QT

后端 未结 1 1535
情歌与酒
情歌与酒 2020-12-19 04:52

I want to list all application which had been installed by reading uninstall registry file from HKEY_CURRENT_USER. But look like it can\'t be done by using QSettings, for so

相关标签:
1条回答
  • 2020-12-19 05:34

    In order to get the list of all sub items under the "Uninstall" one in the Windows registry you need to use QSettings::childGroups() function, i.e:

    QSettings m("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
                QSettings::NativeFormat);
    QStringList ak = m.childGroups();
    

    This will return the list of all installed applications.

    UPDATE:

    After getting the list of installed applications one can read the installation details. There are two ways for doing that. For example to read the "UinstallPath" key for "Autodesk Maya 2014" application:

    m.beginGroup("Autodesk Maya 2014");
    QString path = m.value("UninstallPath").toString();
    m.endGroup();
    

    or simply:

    QString path = m.value("Autodesk Maya 2014/UninstallPath").toString();
    
    0 讨论(0)
提交回复
热议问题