[CPP] view plain copy
void Widget::readregedit ()
{
QString path;
Qdir dir;
-
path=dir.currentpath (); //in Qtcreator Click to run the address is the project address, want to get the app address click on the application in the document (. exe file)
-
qstring sapp = path + "/removefiles.exe" / /My program name   
Sapp.replace ("/","\ \");
Qdebug () <<sApp;
-
qsettings *reg=new qsettings ( Span class= "string" style= "Margin:0px;padding:0px;border:none;color: #0000FF; background-color:inherit;" > "HKEY_LOCAL_MACHINE"
//boot autorun
Reg->setvalue ("Software/microsoft/windows/currentversion/run/removefiles.exe", QVariant (SAPP));
}
[CPP] view plain copy
If executed within Qtcreator, because the current address obtained is the project directory, the path is not
So if you want to test it, go to the application file under the directory (for example, my: RemoveFiles.exe)
QT Setup app on Auto Run