Reading Windows Registry in QT
I want to list all applications that were installed by reading the registry file to remove from HKEY_CURRENT_USER. But it looks like it cannot be done using QSettings, for some security reason (I think).
QSettings maya("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall
People suggest using WinAPI to accomplish this (at least on the Window platform)
Can anyone advise me on how to add and use this library please? thank
To get a list of all the sub items under "Delete" in the Windows registry, you need to use a function QSettings::childGroups()
, ie:
QSettings m("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
QSettings::NativeFormat);
QStringList ak = m.childGroups();
This will return a list of all installed applications.
UPDATE:
After getting a list of installed applications, you can read the installation information. There are two ways to do this. For example, to read the UinstallPath key for an 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();