How to create a file shortcut programatically under windows?
I want to create my applications's shortcut programatically in start menu >> startup group. I also need to be deleted it based on the option in application if user doesn't want auto start feature. I see QFile::link() but could this do the job? I don't know how to use it.
If that is not possible, is the any other way I enable auto-start my application when windows boots up?
SGaist Lifetime Qt Champion last edited by
AFAIK, link is the right choice, note the requirement for Windows.
Create a QFile for the file you want to link to, then call link and pass it the link name. The name can be the full path to were you want to have that link.
Megamouse last edited by
@SGaist do you happen to know if it is possible to add command line arguments to the .lnk ?
If not, I guess it's better to use some OS specific code.
JonB last edited by
I would think that is not possible from a Qt call. @SGaist's
QFile::link(const QString &linkName)is all there is from Qt, and that does not accept extra arguments. Plus Qt and that call is cross-platform, and UNIX soft links don't have any such arguments. So I would think you need to drop down to a Windows-specific call.