Auto run on windows startup problem
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?
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.
I will share after complete my program. That solution is not user friendly.
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.
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?
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.
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.
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.
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.