PDA

View Full Version : setting valeu through registry



sudhansu.kanungo
28th September 2007, 12:43
HI ALL
Im'm new to Qt. Ive stored some values in registry.compiled that and ran it. its running fine. but while changing these values from registry its not updating in exe files. i need u peoples help. IIm pasting the code in below.

void LoadVersionStrings ()

{
//Get the FixedFileInfo block
QSettings settings("MySOFT","STARRUNNER");
settings.setValue("Product Version"," Product Version 7.5.1.1");
settings.value("interval").toString();
settings.setValue("File Version","File Version 7.5.1.1");
QString str1;
QString str2;
QVariant QVariantObj1;
QVariant QVariantObj2;
QSettingsNew = settings.value("DB Systel", true);
QVariantObj1=settings.value("Product Version",1024);
QVariantObj2=settings.value("File Version",1024);
str1=(QVariantObj1).toString () ;
str2=(QVariantObj2).toString () ;
QMessageBox::information(this,"Product Version",str1,0);
QMessageBox::information(this,"File Version",str2,0);
bool test;
//test=contains ( const QString & HKEY_CURRENT_USER/SoftWare/DB Systel );
test=contains ( const QString "HKEY_CURRENT_USER/SoftWare/DB Systel" );
//QWArning()<<test;
}

while changing the value from 7.5.1.1 to 7.5 in registry its not affecting exe file. that is next time im running that exe im getting same output i.e. 7.5.1.1.
Thank you all.

rajeshs
28th September 2007, 13:34
If you changed the value in registry you should read back again from registry then only it will affect ur exe.

jacek
28th September 2007, 20:55
settings.setValue("Product Version"," Product Version 7.5.1.1");
settings.value("interval").toString(); //<---------------------------------------------- this line does nothing
settings.setValue("File Version","File Version 7.5.1.1");
....
QVariantObj1=settings.value("Product Version",1024);
QVariantObj2=settings.value("File Version",1024);
...
while changing the value from 7.5.1.1 to 7.5 in registry its not affecting exe file. that is next time im running that exe im getting same output i.e. 7.5.1.1.
Always read what you wrote. First you change both versions to 7.5.1.1 and then you read them. This way you will always get 7.5.1.1, no matter what's in registry.