Qt 添加启动项

QString application_name = QApplication::applicationName();
QSettings *settings = new QSettings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
if(!settings->allKeys().contains(application_name))
{
QString application_path = QApplication::applicationFilePath();
settings->setValue(application_name, application_path.replace("/", "\\"));
}
delete settings;

posted @ 2016-01-25 14:42  酷熊  阅读(372)  评论(0编辑  收藏  举报