Note that there are some explanatory texts on larger screens.

plurals
  1. PORun application on startup
    primarykey
    data
    text
    <p>i am wondering if its possible to solve this problem. Ive got qt application and if user tick the checkbox, i want this application to launch on startup of operating system. Ive already googled, and ive come up with this solution></p> <p>my QT application needs admin privileges in order to modify registry, so</p> <ol> <li>create manifest file ( <code>&lt;requestedExecutionLevel level="requireAdministrator" uiAccess="false"/&gt;</code>)</li> </ol> <p>2.apply this command</p> <p>mt -manifest manifestfile -outputresource:binfile.exe;1</p> <p>3.use this piece of code in QT to modify registry</p> <pre><code>void MainWindow::set_on_startup() { QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); if (ui-&gt;checkBox-&gt;checkState()) { QString value = QCoreApplication::applicationFilePath(); //get absolute path of running exe QString apostroph = "\""; #ifdef DEBUG ui-&gt;textEdit-&gt;append(QCoreApplication::applicationFilePath ()); #endif value.replace("/","\\"); value = apostroph + value + apostroph + " --argument"; #ifdef DEBUG ui-&gt;textEdit-&gt;append(value); #endif //write value to the register settings.setValue("name", value); } else { settings.remove("name"); } } </code></pre> <p>So, this looks good right ? BUT... application with default admin priveleges cant be launched on startup of operating system, BUT application without admin priveleges cant modify registry. So , there is one solution - tell a user, that if he wants to set this "startup" option, he first needs to start application as admin, then the application will be able to modify registry, and default privileges will remain "asInvoker", but this seems really impractical and i think that users will be discouraged by this.</p> <p>So, how to solve this problem ? how other applications solve this problem ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload