紧急求助 Qt添加开机启动项
以下是添加开机启动项的函数,最近发现不能将启动项添加到注册表中去(以前是可以的),总是报错QSettings: failed to set subkey "SPRunSysterm":
各位大大帮忙分析以下是哪里的问题?
void SetRunParamentDlg::on_bBootStart_clicked(bool checked)//开机自动运行
{
QString path = pwnd->sProjectPath;
qDebug() <
QString sexetPath = QCoreApplication::applicationDirPath();//当前目录
sexetPath = sexetPath.replace("/","\\");
qDebug() <
if(checked)
{
QFile file("RunSystem.bat");
if (!file.open(QIODevice::Truncate | QIODevice::ReadWrite))
{
QMessageBox::warning(NULL, tr("保存文件"),
tr("无法保存文件 %1:\n %2")
.arg(file.errorString()));
}
QTextStream out(&file);
QString sCmd="\"";//sexetPath+"\\SKMonitorSys.exe ";
<