Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Auto run on windows startup problem

Auto run on windows startup problem

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 6.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    harunzontul
    wrote on last edited by
    #1

    Hi,

    I want my application automatically launch at windows startup, according to what i founds on internet a key must be added to windows registry. By using code below i added the key. When i open stated directory on registry, key is there. But application doesn't start on startup. What is wrong?

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

    settings.setValue("MyApp", QCoreApplication::applicationFilePath().replace('/','\\'));@
    
    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      I don't know how to use the registry for startup programs, but you could put a shortcut to your program in the Startup folder.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • H Offline
        H Offline
        harunzontul
        wrote on last edited by
        #3

        I will share after complete my program. That solution is not user friendly.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          harunzontul
          wrote on last edited by
          #4

          Some people add the key to HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER so I changed the that part of code as HKEY_LOCAL_MACHINE but this time key is not added. Rest of the code is same but it didn't work.

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            Are you using an installer? If so, the installer can put the shortcut in the Startup folder. It's not user-friendly because it's not the user's job to put it there.

            Anyway, are you able to launch the application by double-clicking on the icon?

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • H Offline
              H Offline
              harunzontul
              wrote on last edited by
              #6

              @JKSH

              Yes, I dynamically compiled it and added necessary .dlls to exe folder. It works fine. Only auto start feature remain. I can think installer solution if I can't find a way to handle it by using registry. I want to add an option in program which determine whether auto start on or off. As far as I know you can not accomplish this in your solution.

              By the way I learned that if your windows is 64-bit, operations on HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run directory, automatically redirected to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run directory. I found the key on second directory. But still it doesn't work.

              1 Reply Last reply
              0
              • JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                Try asking in a "Microsoft forum":http://social.msdn.microsoft.com/Forums/en-us/home for expert advice on how to launch your program at startup through the Windows registry.

                Good luck

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dbzhang800
                  wrote on last edited by
                  #8

                  bq. But application doesn’t start on startup. What is wrong?

                  Hi, there are two possible situations

                  • You application don't get started. This should not be a problem of Qt.
                  • You application get started, but failed. If relative paths used in your application, and you are not familiar with current working directory. You may have this trouble.
                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    harunzontul
                    wrote on last edited by
                    #9

                    I open windows task manager as soon as windows start and my app is in the processes list but it disappears in several seconds. I tried same thing with an empty gui project it works. I think finding this problem will be a big trouble so I give up.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved