Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I read the windows registry (Default) value using QSettings?

I want to read the registry to find the current PowerPoint version.

However this just returns Zero:

QSettings settings("HKEY_CLASSES_ROOT\\PowerPoint.Application\\CurrVer",
                   QSettings::NativeFormat);

QString sReturnedValue = settings.value("(Default)", "0").toString();

Any suggestions as to how I get the value from a (default) key?

like image 273
Phil Hannent Avatar asked Jul 07 '09 14:07

Phil Hannent


People also ask

What is default registry?

What used to be called simply “the value of a registry key” (for since there was only one, there was no need to give it a name) now goes by the special name the default value: It's the value whose name is null.


2 Answers

Ok, just figured it out. Whilst regedit shows it as (Default) you just read it as Default.

QString sReturnedValue = settings.value( "Default", "0" ).toString();
like image 113
Phil Hannent Avatar answered Oct 23 '22 09:10

Phil Hannent


Also, a period works:

RegReader.value(".", NULL).toString();
like image 38
Rysle Avatar answered Oct 23 '22 08:10

Rysle