Question

I have a problem with this operation only in windows 8.
here is the code which work in other Windwos OS (Win7/Vista/XP)

#ifdef Q_WS_WIN
QSettings bootUpSettings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);

if (runOnbootCheckBox->isChecked())
{
    bootUpSettings.setValue("AppName","\""+base_dir+"\""+ (startMinimizedCheckBox->isChecked() ? " -m" : ""));
}
else
    bootUpSettings.remove("AppName");
#endif

Value from regesty: "C:\Program Files (x86)\Appname\Appname.exe" -m
can any one explain why this code dont work ?

Was it helpful?

Solution

Wow6432 node will be found on a 64 bit windows. This is used to provide a 32 bit environment for your application in 64 bit system. I assume your application is 32 bit. Hence, when it tries to read the Registry values, it will be redirected to the Wow6432 node.

May be, you can add a custom registry key under HKCU to decide whether to run the app or not after starting up from Wow6432 node as mentioned above.

That is add your startup entry here:

HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run

An then, add a custom entry in HKCU for deciding whether to continue running the app or to close it.

I mean, you can add a separate logic in your application for that.

OTHER TIPS

Include this header QSettings

#include <QSettings>

And add this in your code.

QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); settings.setValue("YourApplicationName", QCoreApplication::applicationFilePath().replace('/', '\\'));

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top