Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7583051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:35:20+00:00 2026-05-30T18:35:20+00:00

i am wondering if its possible to solve this problem. Ive got qt application

  • 0

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>

my QT application needs admin privileges in order to modify registry, so

  1. create manifest file ( <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>)

2.apply this command

mt -manifest manifestfile -outputresource:binfile.exe;1

3.use this piece of code in QT to modify registry

void MainWindow::set_on_startup() {

QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);

       if (ui->checkBox->checkState()) {
        QString value = QCoreApplication::applicationFilePath(); //get absolute path of running exe
        QString apostroph = "\"";

        #ifdef DEBUG
        ui->textEdit->append(QCoreApplication::applicationFilePath ());
#endif

       value.replace("/","\\");
       value = apostroph + value + apostroph + " --argument";

#ifdef DEBUG
       ui->textEdit->append(value);
#endif
        //write value to the register
        settings.setValue("name", value);


    }
    else {
         settings.remove("name");
    }
}

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.

So, how to solve this problem ? how other applications solve this problem ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:35:21+00:00Added an answer on May 30, 2026 at 6:35 pm

    For everybody who are trying to solve the problem, this is the 100% working solution:

    How can I ask the user for elevated permissions at runtime?

    1. create app1.exe
    2. create app2.exe with admin priveleges – tutorial is in the first post (manifest file, mt.exe, etc..)
    3. when user tick the checkbox in app1.exe, i call the the app2.exe (for example with no arguments) – you can find all function for this @ the link ive just posted above
      // well, in fact, you dont have to use the function from the example above:
      i find this call much better

                    QObject *parent = new QObject();
                    QString program = AppToExec; //"/path/to/the/app2.exe"
                    QStringList arguments ;
                    arguments << ""; //just in case we want arguments
                    QProcess *myProcess = new QProcess(parent);
                    myProcess->start(program);
      
    4. app2.exe, for example

        QApplication a(argc, argv);
        MainWindow w;
      //  w.show();
       if (argc == 1) {
       w.test();
       a.quit();
      
      }
      
    5. problem solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to solve this problem. I was wondering if it's possible to use
I was wondering if its possible to redirect a user to a web page
I'm wondering if its possible to do this. The issue being that im trying
I was wondering if its possible to get Android application info like (name, version,
I was wondering if its possible to change my applications launch images with out
I'm wondering if its possible to add new class data members at run-time in
I was wondering if its possible to inject a thread into a remote app
I am wondering how its possible to permanently show the vertical bar of a
I was wondering if its possible to use the Google maps IFRAME code to
I am wondering if its possible to to open a port listen for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.